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.
51 lines
1.3 KiB
51 lines
1.3 KiB
12 months ago
|
{#
|
||
|
/**
|
||
|
* @file
|
||
|
* Theme override for an individual form element.
|
||
|
*
|
||
|
* Available variables for all fields:
|
||
|
* - multiple: Whether there are multiple instances of the field.
|
||
|
*
|
||
|
* Available variables for single cardinality fields:
|
||
|
* - elements: Form elements to be rendered.
|
||
|
*
|
||
|
* Available variables when there are multiple fields.
|
||
|
* - table: Table of field items.
|
||
|
* - description: The description element containing the following properties:
|
||
|
* - content: The description content of the form element.
|
||
|
* - attributes: HTML attributes to apply to the description container.
|
||
|
* - button: "Add another item" button.
|
||
|
*
|
||
|
* @see template_preprocess_field_multiple_value_form()
|
||
|
*
|
||
|
* @ingroup themeable
|
||
|
*/
|
||
|
#}
|
||
|
{% if multiple %}
|
||
|
{%
|
||
|
set classes = [
|
||
|
'js-form-item',
|
||
|
'form-item'
|
||
|
]
|
||
|
%}
|
||
|
{%
|
||
|
set description_classes = [
|
||
|
'form-item__description',
|
||
|
disabled ? 'is-disabled',
|
||
|
]
|
||
|
%}
|
||
|
<div{{ attributes.addClass(classes) }}>
|
||
|
{{ table }}
|
||
|
{% if description.content %}
|
||
|
<div{{ description.attributes.addClass(description_classes) }}>{{ description.content }}</div>
|
||
|
{% endif %}
|
||
|
{% if button %}
|
||
|
<div class="form-actions">{{ button }}</div>
|
||
|
{% endif %}
|
||
|
</div>
|
||
|
{% else %}
|
||
|
{% for element in elements %}
|
||
|
{{ element }}
|
||
|
{% endfor %}
|
||
|
{% endif %}
|