Craft CMS Asked by Mark Notton on April 7, 2021
I have a few tabs in my “Field Layout Design”, and I wondered if there was a way to list the titles of each one, in the frontend? Something basic like:
<ul>
<li>Services</li>
<li>Testimonials</li>
<li>Gallery</li>
</ul>
Thanks 🙂
Assuming you have an 'entry', this should work:
{% for tab in entry.getFieldLayout().getTabs() %}
<ul>
<li>{{ tab.name }}
<ul>
{% for field in tab.getFields() %}
<li>{{ field.name }}</li>
{% endfor %}
</ul>
</li>
</ul>
{% endfor %}
if you don't need the fields then just:
{% for tab in entry.getFieldLayout.getTabs() %}
<ul>
<li>{{ tab.name }}</li>
</ul>
{% endfor %}
Correct answer by Douglas McDonald on April 7, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP