I must simply be blanking this morning, but for whatever reason, this has me stumped... I have a Structure section I use for the different sections of my site which sets titles for each page, etc.
Additionally, I have another section called "Widgets". These widgets are stored in the template folder and each widget is linked up to a dedicated entry in an Asset field. Finally, each Structure entry (take the home page for example) has a Matrix field. This allows me to rapidly add new pages from templates I have already built. Unfortunately this time around I am having trouble pulling the filename for the widgets, though I seem to be able to grab the asset IDs. Following is the code. Thank you in advance for the help; I am sure it is simple but I've been banging my head against my desk for a little too long now...
{% block contentPrimary %}
{% switch entry.type %}
{% case "mainContentLeft" %}
{% for block in entry.contentPrimary %}
{% switch block.type %}
{% case "text" %}
{{ block.text }}
{% case "widget" %}
{% if block.widgetPrimary|length and block.entry[0].widgets|length %}
{{ block.widgetPrimary[0].widgets[0].filename }}
{% endif %}
{% endswitch %}
{% endfor %}
{% case "mainContentRight" %}
Main Content Right
{% case "singleColumn" %}
Single Column
{% endswitch %}
{% endblock contentPrimary %}
After trying a few different things, I've seen a couple different errors, but the error I see at present states:
Craft\MatrixBlockModel and its behaviors do not have a method or closure named "widgetPrimary".
Thank you again, in advance!