How do you get a list of the fields that are on an entry?

I tried {{ dump(entry.subentry) }} but that isn't any help ...


I think you can use this:

{% for field in entry.subentry[0].getFieldLayout().getFields() %}
    {{ field.getField().name }} {# or .handle #}
{% endfor %}

You might try a great little plugin called inspector that prints out all of the attributes and methods of an object using either filter {{ entry.subentry|inspect }} or method {{ inspect(entry.subentry) }} syntax. Its output is a little cleaner than dump, and nice for following the rabbit-hole.

| improve this answer | |

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.