- Issue created by @ahmad abbad
- Status changed to Needs work
7 months ago 10:37am 26 May 2024
The accordion component is working on the block and we need to create a default component for nodes
1- Create a content type
2- Add field paragraph [field_accordion] and use the current paragraph items
3- Render the field{% set accordion_items = [] %} {% for accordion_item_paragraph in items %} {% set accordion_item_header = accordion_item_paragraph.content['#paragraph'].field_title.value %} {% set accordion_item_body = { '#type': 'processed_text', '#text': accordion_item_paragraph.content['#paragraph'].field_body.value, '#format': accordion_item_paragraph.content['#paragraph'].field_body.format, } %} {% set accordion_item_expanded = (accordion_item_paragraph.content['#paragraph'].field_expanded and accordion_item_paragraph.content['#paragraph'].field_expanded.value == true) ? true : false %} {% set accordion_item = {'header': accordion_item_header, 'body': accordion_item_body, 'expanded': accordion_item_expanded } %} {% set accordion_items = accordion_items|merge([accordion_item]) %} {% endfor %} {% include "varbase_components:accordion" with { title_tag: 'h2', heading: label, items: accordion_items, } %}
field_accordion
with the accordion component in content types.field_accordion
config in Varbase Core, to be able to re-use with content types.Needs work
3.0
Code