3

It's tough to see the full context, just based on what you have here. From what I can tell, it seems like you might need to change <img src="{{ image.file }}" alt=""> to <img src="{{ image.file.first().url }}" alt="">. Since the asset field can hold many assets, you have to declare .first() to grab the first one -- even if there's only one image....


3

I always think of this sort of thing as a finite state machine. Your states are whether or not you are in the div, and for each block, you change state or not depending on what state you are currently in, and what that block type is. Like this: {# initial state: not in the div #} {% set inTheDiv = false %} {% for block in blocks %} {# should this block ...


2

I ended up fixing this with a variable and querying it myself. In this case I needed the related entry if it was linked and a false if it wasn't. $neoElement = craft()->db->createCommand() ->select('craft_relations.sourceId') ->from('relations') ->where('craft_relations.fieldId = 110') ->andWhere('craft_relations.targetId =...


2

For anyone else having a similar problem, the solution was this: {% for module in entry.pageBuilder.all() %} {% do module.useMemoized(entry.pageBuilder) %} {% endfor %} {% for module in entry.pageBuilder.all() if module.level == 1 %} {% if module.type != 'moduleColumn' %} {% include '_partials/page-builder/_' ~ ...


2

Your above code is not working because you are using "block" instead of "item" in your children. So... {% for item in block.children %} {% switch item.type.handle %} You don't necessarily need to do a switch here, you could do a series of includes and make their file names match your block type... so "_includes/neo/box.twig" and "_includes/neo/image....


2

This is because of a change in Craft 3 and you need to clone your query (docs). I have not tested this but the below should work: {% set blocks = entry.nutritionBuilder %} {% set item = clone(blocks).type('blockCalories').one() %} {{ item.nutritionValue }} {% for block in clone(blocks).level(1).all() %} ... {% endfor %}


1

I just figured it out. For anyone facing the same issue, here is what worked for me: $entryData = self::setupEntryData($item); $entry = new Entry($entryData); $fieldValues = [ 'blocks' => [ // Neo field handle 'new0' => [ 'modified' => 1, 'type' => 'wysiwyg', // Neo block handle 'enabled' => 1,...


1

When an Edit Entry page is loaded, Craft takes note of all the fields’ current form values, and when the form is submitted, only field values that have changed will be posted. As far as the back-end is concerned, if a field is included in the post data, then it was changed; otherwise it wasn’t. I suspect that the modified param you are seeing is a Neo-...


1

In reply. In a tweet from Brandon... Neo will get a direct upgrade path to matrix. https://twitter.com/brandonkelly/status/1114144432243265536?s=19 That being said. I used supertable more recently.


1

Hopefully someone has a better answer than me, but I’ve been in the same situation recently and the way I eventually did it was to output the field for each page in Json using element api, then create a new field that does allow different blocks per locale/site and re-import the content back into that field per locale using feed me. I left both fields on ...


1

Just by the way, Neo is currently not supported with Feed Me. You're welcome to upvote this feature request - https://github.com/verbb/feed-me/issues/335


1

The issue here was not to do with NEO or how to access them, it was the loop index call to the parent not getting the correct context. {{ loop.parent.index }} was the issue. It needed to be {{ loop.parent.loop.parent.loop.index }}


1

You'll need to reference the field handle within asset. For instance > {{ asset.imageHandle.getUrl('square') }}. I'm guessing you aren't seeing {{ asset.title }} either?


1

The answer by Tom Bauer given to my question here should be of help. You're not far off. You need to set a variable and count the blocks in your neo loop. Then use if statements in the loop depending on the counter variable. The other option is you add a columnWidth dropdown field, and give them the option to choose between 2 or 3, the values are the css (...


1

You're essentially running into this bug: https://github.com/craftcms/cms/issues/16 It has been fixed for the upcoming Craft 3, but the fix was involved likely won't be backported to Craft 2.


1

i removed {slug} altogether from an Asset field definition.


1

The {% cache %} tag tracks Elements (Users, Entries, Categories, Tags, etc.), so if you're want to do this using a plugin, then the plugin's field type needs to inherit from BaseElementFieldType and needs to implement its own element type. From there, it's just a matter of calling craft()->templateCache->includeElementInTemplateCaches().


1

I figured it out by modifying the code from this answer on image transforms. Here's the basics of my markup. <div class="{% if loop.length == 2 %}grid-one-half{% elseif loop.length == 3 %}grid-one-third{% elseif loop.length == 4 %}grid-one-quarter{% endif %} grid-item"> </div>


1

So it should be: {% set entries = block.teamGetEntres %} {% if entries | length %} {% for entry in entries %} <p class="description">{{ entry.description }}</p> {% endfor %} {% endif %} replace "entry" in entry.teamGetEntries with "block"


1

You must call the inner blocks (level2, level3 and so on) like the first level {% if entry.bodyMain is defined and entry.bodyMain | length %} {% nav block in entry.bodyMain.level(1) %} {% switch block.type.handle %} {% case 'accordion' %} <ul class="accordion accordion-2"> {% nav block in ...


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