59 lines
2.4 KiB
Twig
59 lines
2.4 KiB
Twig
{#
|
|
/**
|
|
* @file
|
|
* Default theme implementation for a form element.
|
|
*
|
|
* Available variables:
|
|
* - attributes: HTML attributes for the containing element.
|
|
* - prefix: (optional) The form element prefix, may not be set.
|
|
* - suffix: (optional) The form element suffix, may not be set.
|
|
* - required: The required marker, or empty if the associated form element is
|
|
* not required.
|
|
* - label: A rendered label element.
|
|
* - label_display: Label display setting. It can have these values:
|
|
* - before: The label is output before the element. This is the default.
|
|
* The label includes the #title and the required marker, if #required.
|
|
* - after: The label is output after the element. For example, this is used
|
|
* for radio and checkbox #type elements as set in system_element_info().
|
|
* If the #title is empty but the field is #required, the label will
|
|
* contain only the required marker.
|
|
* - invisible: Labels are critical for screen readers to enable them to
|
|
* properly navigate through forms but can be visually distracting. This
|
|
* property hides the label for everyone except screen readers.
|
|
* - attribute: Set the title attribute on the element to create a tooltip but
|
|
* output no label element. This is supported only for checkboxes and radios
|
|
* in form_pre_render_conditional_form_element(). It is used where a visual
|
|
* label is not needed, such as a table of checkboxes where the row and
|
|
* column provide the context. The tooltip will include the title and
|
|
* required marker.
|
|
* - description: (optional) A list of description properties containing:
|
|
* - content: A description of the form element, may not be set.
|
|
* - attributes: (optional) A list of HTML attributes to apply to the
|
|
* description content wrapper. Will only be set when description is set.
|
|
*
|
|
* @see template_preprocess_form_element()
|
|
*
|
|
* @ingroup themeable
|
|
*/
|
|
#}
|
|
<div{{ attributes }}>
|
|
{% if label_display in ['before', 'invisible'] %}
|
|
{{ label }}
|
|
{% endif %}
|
|
{% if prefix is not empty %}
|
|
<span class="field-prefix">{{ prefix }}</span>
|
|
{% endif %}
|
|
{{ children }}
|
|
{% if suffix is not empty %}
|
|
<span class="field-suffix">{{ suffix }}</span>
|
|
{% endif %}
|
|
{% if label_display == 'after' %}
|
|
{{ label }}
|
|
{% endif %}
|
|
{% if description.content %}
|
|
<div{{ description.attributes }}>
|
|
{{ description.content }}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|