3

Is it possible to check a matrix array for an ID?

I created a entries field which functions as a navigation. Now if the user decides to remove one entry I want the specific template to return a 404

enter image description here

I thought something like (Assuming we are in the "Journalismus" template):

{% for navi in navigation.navi %}
    {% if '4' not in navi.id %}
        {% exit 404 %}
    {% endif %}
{% endfor  %}

But that does pass the 404 always.

Or is there a better way to do this?

3
{% if '4' not in navigation.navi.ids() %}
    {% exit 404 %}
{% endif %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.