{# @var craft \craft\web\twig\variables\CraftVariable #} {# @var entry \craft\elements\Entry #} {# Content Builder Neo ====================== Neo Content Builder use the Neo Plugin #} {# -- Set Defaults -- #} {% set defaults = { cn: 'o-contentBuilder', modifiers: [], customClasses: [], object: entry ?? null, context: '12:24' } %} {# -- Merge Default with Options -- #} {% set opt = opt is defined ? defaults|merge(opt) : defaults %} {% if opt.object %} {# -- Colums Context -- #} {% set context = opt.context | split(':') %} {% set contextFirst = context[0] %} {% set contextLast = context[1] %}
{% if opt.object.contentBuilder.level(1)|length %} {% set neoField = opt.object.contentBuilder.level(1) %} {% for content in neoField %} {# Check if first Type is not a Section #} {% if loop.first and content.type != 'bkSection' %} {% include '_organisms/section/_template.html' with { opt: { modifiers: ['cb'], context: 'o-col-' ~ contextFirst ~ ' o-col-s-' ~ contextLast } } only %} {% endif %} {# Check if an other Section is opened and close the Section before #} {% if content.type == 'bkSection' %} {% if not loop.first %}
{% endif %} {% include '_contentBuilders/_contentBuilderModules.html' with { data: content, context: opt.context } only %} {# All other Content Modules #} {% elseif content.type != 'bkSection' %} {% include '_contentBuilders/_contentBuilderModules.html' with { data: content, context: opt.context } only %} {% endif %} {% endfor %} {% endif %} {% endif %}