form-element-label--gin-lb.html.twig in Gin Layout Builder 1.0.x
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
File
templates/form/form-element-label--gin-lb.html.twigView 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 = [
- 'form-item__label',
- title_display == 'after' ? 'option',
- title_display == 'invisible' ? 'visually-hidden',
- required ? 'js-form-required',
- required ? 'form-required',
- ]
- %}
- {% if title is not empty or required -%}
- <label{{ glb_classes(attributes.addClass(classes)) }}>{{ title }}</label>
- {%- endif %}