Hot answers tagged

13

You need to allow to list bucket location. Also, I'm not confident if you'd be able to upload and delete objects from the bucket with that policy. I'd go with: { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:ListAllMyBuckets" ], "Resource": "*" }, { "Effect": "...


4

Element Types, Custom Fields, and Sources can work closely together, but how you structure that relationship has a lot of flexibility. Sources are optional. They are a convenient way to group and filter Elements, but they vary in the way that they group those Elements – Globals use Global Sets, Categories use Category Groups, Entries use Sections – and if ...


3

My solution, thanks to @carlcs: public function modifyEntrySources(&$sources, $context) { $sources[] = array('heading' => Craft::t('Themes')); $themes = array( 'THEME_FOO' => 'themeFoo', 'THEME_BAR' => 'themeBar' ); $criteria = craft()->elements->getCriteria(ElementType::Entry); $criteria->section =...


3

You can use the Event System from Yii/Craft and check for the file size during an upload Event::on( Asset::class, Element::EVENT_BEFORE_SAVE, function(ModelEvent $modelEvent){ /** @var Asset $model */ $model = $modelEvent->sender; $tmpPath = $model->tempFilePath; $fileSize = filesize($tmpPath); if($...


2

I'm no AWS expert but does your iam user have the correct access/secret keys as well? While you're at it, you might as well grant PutObject, GetObject, and DeleteObject in that policy as well so Craft has access to the objects in it. See this blog post by Amazon for a good starting point.


2

Craft has no settings defined for it. The only setting it has is maxUploadFileSize which you have already mentioned. So the solution of this is using Imager Plugin. There is also a blog from nystudio107 on this. Let Client upload image of any size or dimension, but you could resize them using Imager plugin.


2

After a little more digging, I discovered this can be achieved by adding a data array with a handle value to the source, so that code becomes: public function modifyEntrySources(&$sources, $context) { if ($context == 'index') { $sources[] = array('heading' => 'Translations'); $sources['translations:untranslated'] = array( ...


2

UIDs are not yet usable in queries. You would need to extract the UID of the section from the string then fetch the sectionId to use in your query. Something like this: {% for tab in entry.fieldLayout.tabs %} {{ tab.name }} {% for field in tab.getFields() %} <label for="{{ field.handle }}">{{ field.name }}</label> <br> ...


1

After getting some feedback from Craft support it turns out one has to use uid instead of id for this to work: "sources" => ["section:" . $questionsSection->uid], Since I had a lot of places in my migration where I needed to specify sources, I included a couple small functions: /* --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- */ ...


1

Of course, just create a new asset source (settings > volumes > new volume) then in your image field select 'Restrict uploads to a single folder' in your field and then select the asset source you just created.


1

You can set it to ':empty:', as mentioned in the DbHelper::parseParam() documentation.


1

It seems on your website that you get the team listed, but not the photos. I think the problem might be that you are accessing the teamMembersPhotoof the entry, not the team. You can try changing it to {% for asset in team.teamMembersPhoto.find() %}


1

Your plugin has to create those routes — via registerCpRoutes() — to match your desired URL structure. Routes either trigger a site template or a controller, as described in the Routing docs. (Craft's own internal convention is for CP routes to trigger a controller method, which sets up the request and renders your desired template.) You can ...


1

I ended up doing this the old-fashioned way... hire cheap labor to do a tedious repetitious task! Every other suggestion I got (here and in Slack) involved command line scripting and/or careful database manipulation. I wasn't really comfortable with either of those, especially since I had already started the drag & drop process. So in the end, I just ...


1

I did this with grunt, using the grunt-aws-s3 task. It worked beautifully. If you are a gulp person, I'm sure there is something similar for gulp.


1

You could use entries instead of categories. Create four structures and use them instead of your category groups. Your category field will actually be an entry field, and it can pull from the four structures, with a limit of one.


1

What are your 4 sources used for? Depending on your content you might be able to work around it. There's no exact science to this but in my experience doing IA, here's a few thoughts on category sources: I like to set mine up so they kind of match the sections I'm posting in. If you have to reach across multiple category sources for a field—say you only ...


1

You cannot allow selection from multiple category sources in a category field. I would keep the 4 category fields but set each field to limit to one (1) category selection. Then, when you add the field to the field layout, make the field required to ensure they select a category for each field.


Only top voted, non community-wiki answers of a minimum length are eligible