I have a case where I need to access a previous matrix field's value (if it exists) in the next matrix loop result.
{% for contentBlock in entry.contentBlocks %}
{% if contentBlock.prev %}
{% if contentBlock.getPrev().matrixField | length %}
{{ contentBlock.getPrev().matrixField }}
{% endif %}
{% endif
....
{% endfor %}
I know that my issue is with {{ contentBlock.getPrev().matrixField }} but I am not sure how to access the field value after trying several methods. I'm sure it's something simple.
Thanks :)
{{ contentBlock.prev['matrixField'] }}– Gogster Jan 25 '16 at 18:43