form-element-label.html.twig
Same filename in this branch
Same filename in other branches
- 9 core/profiles/demo_umami/themes/umami/templates/classy/form/form-element-label.html.twig
- 9 core/themes/stable9/templates/form/form-element-label.html.twig
- 9 core/themes/seven/templates/classy/form/form-element-label.html.twig
- 9 core/themes/claro/templates/form-element-label.html.twig
- 9 core/themes/bartik/templates/classy/form/form-element-label.html.twig
- 9 core/themes/stable/templates/form/form-element-label.html.twig
- 9 core/themes/starterkit_theme/templates/form/form-element-label.html.twig
- 9 core/themes/classy/templates/form/form-element-label.html.twig
- 9 core/modules/system/templates/form-element-label.html.twig
- 8.9.x core/profiles/demo_umami/themes/umami/templates/classy/form/form-element-label.html.twig
- 8.9.x core/themes/seven/templates/classy/form/form-element-label.html.twig
- 8.9.x core/themes/claro/templates/form-element-label.html.twig
- 8.9.x core/themes/bartik/templates/classy/form/form-element-label.html.twig
- 8.9.x core/themes/stable/templates/form/form-element-label.html.twig
- 8.9.x core/themes/classy/templates/form/form-element-label.html.twig
- 8.9.x core/modules/system/templates/form-element-label.html.twig
- 11.x core/profiles/demo_umami/themes/umami/templates/components/form/form-element-label.html.twig
- 11.x core/themes/stable9/templates/form/form-element-label.html.twig
- 11.x core/themes/claro/templates/form-element-label.html.twig
- 11.x core/themes/starterkit_theme/templates/form/form-element-label.html.twig
- 11.x core/modules/system/templates/form-element-label.html.twig
Theme override for a form element label.
Available variables:
- title: The label's text.
- title_display: Elements title_display setting.
- required: An indicator for whether the associated form element is required.
- attributes: A list of HTML attributes for the label.
See also
template_preprocess_form_element_label()
2 theme calls to form-element-label.html.twig
- Label::getInfo in core/
lib/ Drupal/ Core/ Render/ Element/ Label.php - template_preprocess_form_element in core/
includes/ form.inc - Returns HTML for a form element.
File
-
core/
themes/ starterkit_theme/ templates/ form/ form-element-label.html.twig
View source
- {#
- /**
- * @file
- * Theme override for a form element label.
- *
- * Available variables:
- * - title: The label's text.
- * - title_display: Elements title_display setting.
- * - required: An indicator for whether the associated form element is required.
- * - attributes: A list of HTML attributes for the label.
- *
- * @see template_preprocess_form_element_label()
- */
- #}
- {%
- set classes = [
- title_display == 'after' ? 'option',
- title_display == 'invisible' ? 'visually-hidden',
- required ? 'js-form-required',
- required ? 'form-required',
- ]
- %}
- {% if title is not empty or required -%}
- <label{{ attributes.addClass(classes) }}>{{ title }}</label>
- {%- endif %}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.