Remove all the item wrapper unwanted mess

This commit is contained in:
benjamin melançon 2018-10-26 01:50:54 -04:00
parent 4a8191301b
commit b846522aad

View file

@ -50,22 +50,6 @@
{% set title_attributes = title_attributes.addClass(title_classes) %} {% set title_attributes = title_attributes.addClass(title_classes) %}
{# Child templates can specify classes to be added to items. #} {# Child templates can specify classes to be added to items. #}
{% set item_classes = item_classes ?? [] %} {% set item_classes = item_classes ?? [] %}
{# Child templates can specify whether items should be wrapped. #}
{% set use_item_wrapper = use_item_wrapper is defined ? use_item_wrapper : true %}
{% macro render_item(item, item_classes, use_item_wrapper) %}
{%
set item = item|merge({
'attributes': item.attributes.addClass(item_classes)
})
%}
{% if use_item_wrapper %}
<div{{ item.attributes }}>{{ item.content }}</div>
{% else %}
{{ item.content }}
{% endif %}
{% endmacro render_item %}
{% import _self as helpers %}
{% if label_hidden %} {% if label_hidden %}
{% for item in items %} {% for item in items %}
@ -74,14 +58,8 @@
{% else %} {% else %}
<p{{ attributes }}> <p{{ attributes }}>
<label{{ title_attributes }}>{{ label }}</label> <label{{ title_attributes }}>{{ label }}</label>
{% if multiple and use_item_wrapper %}
<div>
{% endif %}
{% for item in items %} {% for item in items %}
<strong>{{ helpers.render_item(item, item_classes, use_item_wrapper) }}</strong> <strong>{{ item.content }}</strong>
{% endfor %} {% endfor %}
{% if multiple and use_item_wrapper %}
</div>
{% endif %}
</p> </p>
{% endif %} {% endif %}