When checking if a matrix block property is defined, I'm getting an error:
Craft\EntryModel and its behaviors do not have a method or closure named "contentSource".
The line that is throwing this error is specifically checking if that property is defined.
{% if block.contentSource is defined %}
{# Stuff and things #}
{% endif %}
-- Or --
{% set theThing = block.contentSource ?? "fallback" %}
Am I expecting the "is defined" check to be smarter than it actually is? I can't see an example of this in the matrix field or craft twig/templating docs.
Thanks :)
block['contentSource']instead or test against an attribute rather than a field, e.g.if block.type == 'foo'. – carlcs Dec 14 '16 at 22:05