I have Paragraphs installed and am creating a content-type which has nested Paragraphs - so there is a Paragraph with a Title Field, a Body Field - this is then nested in a another Paragraph, so that I can have several boxes across the page. So far so good - what I want to learn is to output the fields so I can put them in jQuery UI tabs.
In my template I currently have:
{{ content.field_tab_title }}
{{ content.field_body }}
Which outputs: Title Body Title Body Title Body etc.
What I need is: Title Title Title Body Body Body
So that I can put all the titles in li's for jQuery UI. I've tried putting
{% for item in items %} {{ content.field_tab_title }} {% endfor %}
But then nothing comes out at all.
UPDATE Following Kevin's Suggestions, I've started again with my templates and have now got;
in paragraph--tab.html.twig
:
<ul class="tab-box">
{{ content.field_tab_title }}
</ul>
<div>{{ content.field_body }}</div>
and in field--paragraph--tab.html.twig
:
{% for item in items %}
<li class="tab-title">{{ item.content }}</li>
{% endfor %}
but this is still outputting:
<ul><li>Tab Title - 1</li></ul>
<div>Body Copy 1</div>
<ul><li>Tab Title - 2</li></ul>
<div>Body Copy 2</div>
But what I need is:
<ul><li>Tab Title - 1</li><li>Tab Title - 2</li></ul>
<div>Body Copy 1</div>
<div>Body Copy 2</div>