I'm trying to pull in the contents of a matrixField block and merge it with some default info —
{% set interviews = craft.entries.section('interviews') %}
{% for interview in interviews %}
{% set blocks = interview.thumb %}
{% for block in blocks %}
{% set options = block|merge({
'class': 'episode',
'more': 'Listen to this interview...',
'slug': craft.request.firstSegment,
'linkUrl': interview.url,
}) %}
{% include '_includes/blocks/half-block.html' with { options: options } %}
{% endfor %}
{% endfor %}
I get the error: Key "body" for array with keys "id, enabled, archived, locale, localeEnabled, slug, uri, dateCreated, dateUpdated, root, lft, rgt, level, searchScore, fieldId, ownerId, ownerLocale, typeId, sortOrder, collapsed, class, more, reverse, linkUrl" does not exist
Why am I getting block
with the values of the entry instead of that single block of type thumb
?
(where thumb
has a field called body
)
I had tried {% set block = interview.thumb.first() %}
instead of {% set blocks = interview.thumb %}{% for block in blocks %}
but was trying to be more explicit to see if it made a difference.
options.body
in the partial?) are common to all elements in Craft, so it may look like anEntryModel
but quack like aMatrixBlockModel
… That's the expression, right?