Display selected existing text fields using labels embedded in their values. Drupal 11 ready
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

12 lines
643 B

{# Render one label per value, keeping normal field/item attributes. #}
{% set classes = ['field', 'field--name-' ~ field_name|clean_class, 'field--type-' ~ field_type|clean_class, 'field--label-' ~ label_display|clean_class] %}
<div{{ attributes.addClass(classes) }}>
{% for item in dynamic_field_label_items|default(items) %}
<div{{ item.attributes.addClass('field__item') }}>
{% if item.dynamic_label is defined and item.dynamic_label is not null %}
<span class="field__label">{{ item.dynamic_label }}:</span>
{% endif %}
<span class="field__value">{{ item.content }}</span>
</div>
{% endfor %}
</div>