76 lines
2.9 KiB
Twig
76 lines
2.9 KiB
Twig
{#
|
|
/**
|
|
* @file
|
|
* Template to provide expert HTML for the field.
|
|
*
|
|
* Available variables:
|
|
* - element: The field element.
|
|
* - label: The label of the field.
|
|
* - settings: The settings for the field.
|
|
* - items: List of all the field items. Each item contains:
|
|
* - attributes: List of HTML attributes for each item.
|
|
* - content: The field item's content.
|
|
*/
|
|
#}
|
|
|
|
{{- settings['prefix']|raw -}}
|
|
{% if settings.ow %}
|
|
{% if settings['ow-def-at'] %}
|
|
<{{ settings['ow-el'] }} {{ wrapper_attributes.mergeAttributes(attributes) }}>
|
|
{% elseif settings['ow-def-cl'] %}
|
|
<{{ settings['ow-el'] }} {{ wrapper_attributes.mergeAttributes(attribute_classes.offsetGet('class')) }}>
|
|
{% else %}
|
|
<{{ settings['ow-el'] }} {{ wrapper_attributes }}>
|
|
{% endif %}
|
|
{{ _self.field(items, settings, label, content_attributes, field_item_wrapper_attributes, field_wrapper_attributes, label_attributes, label_hidden, element) }}
|
|
</{{ settings['ow-el'] }}>
|
|
{% else %}
|
|
{{ _self.field(items, settings, label, content_attributes, field_item_wrapper_attributes, field_wrapper_attributes, label_attributes, label_hidden, element) }}
|
|
{% endif %}
|
|
{{- settings['suffix']|raw -}}
|
|
|
|
{% macro field(items, settings, label, content_attributes, field_item_wrapper_attributes, field_wrapper_attributes, label_attributes, label_hidden, element) %}
|
|
{% if not label_hidden %}
|
|
{%
|
|
set title_classes = [
|
|
'field-label-' ~ element['#label_display']|clean_class,
|
|
]
|
|
%}
|
|
{%- if settings['lbw-def-at'] -%}
|
|
<{{ settings['lbw-el']|default('div') }} {{ label_attributes.addClass(title_classes).mergeAttributes(title_attributes) }}>
|
|
{%- else -%}
|
|
<{{ settings['lbw-el']|default('div') }} {{ label_attributes.addClass(title_classes) }}>
|
|
{%- endif -%}
|
|
{{- label -}}{%- if settings['lb-col'] -%}:{%- endif -%}
|
|
</{{ settings['lbw-el']|default('div') }}>
|
|
{% endif %}
|
|
|
|
{% if settings.fis %}
|
|
{% if settings['fis-def-at'] %}
|
|
<{{ settings['fis-el'] }} {{ field_wrapper_attributes.mergeAttributes(content_attributes) }}>
|
|
{% else %}
|
|
<{{ settings['fis-el'] }} {{ field_wrapper_attributes }}>
|
|
{% endif %}
|
|
{{ _self.content(items, settings, field_item_wrapper_attributes, content_attributes) }}
|
|
</{{ settings['fis-el'] }}>
|
|
{% else %}
|
|
{{ _self.content(items, settings, field_item_wrapper_attributes) }}
|
|
{% endif %}
|
|
{% endmacro %}
|
|
|
|
{% macro content(items, settings, field_item_wrapper_attributes, content_attributes) %}
|
|
{% for item in items %}
|
|
{% if settings.fi %}
|
|
{% if settings['fi-def-at'] %}
|
|
<{{ settings['fi-el'] }} {{ field_item_wrapper_attributes.mergeAttributes(item.attributes) }} >
|
|
{% else %}
|
|
<{{ settings['fi-el'] }} {{ field_item_wrapper_attributes }} >
|
|
{% endif %}
|
|
{{- item.content -}}
|
|
</{{ settings['fi-el'] }}>
|
|
{% else %}
|
|
{{ item.content }}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endmacro %}
|