5

enter image description here

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 :)

6

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 %}
7
  • This worked perfectly. Exactly what I was after. Thank you Douglas :) Dec 16 '14 at 9:23
  • How to get the value of a field of tabs? Jan 28 '15 at 0:56
  • @DouglasMcDonald For example in the tab "gallery" is the field of "image", how to get it? entry.image nothing gives, only if "image" was in the first tab Jan 28 '15 at 1:11
  • @VitaliyBadalov I don't understand your question? What do you mean by a "value of a field of tabs"? Do you mean "value of a field within the tabs"? In the future it might be best to create a new question (with a link to this question). Jan 28 '15 at 1:15
  • I'll be glad to help, but can you start a new question please. It's hard to give a good answer within comments. Jan 28 '15 at 1:18

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.