Issue #2152215 by joelpittet, mr.baileys, benjifisher, martin107, rteijeiro, hussainweb, shanethehat, jenlampton, kpa, AnythonyR, EVIIILJ, kgoel, Cottser, dsdeiz, hanpersand, bayousoft: Convert theme_form_element_label() to Twig
2014-06-12 17:20:10 +00:00
|
|
|
{#
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Default theme implementation for a form element label.
|
|
|
|
*
|
|
|
|
* Available variables:
|
|
|
|
* - title: The label's text.
|
2014-10-08 10:52:46 +00:00
|
|
|
* - title_display: Elements title_display setting.
|
Issue #2152215 by joelpittet, mr.baileys, benjifisher, martin107, rteijeiro, hussainweb, shanethehat, jenlampton, kpa, AnythonyR, EVIIILJ, kgoel, Cottser, dsdeiz, hanpersand, bayousoft: Convert theme_form_element_label() to Twig
2014-06-12 17:20:10 +00:00
|
|
|
* - 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()
|
|
|
|
*
|
|
|
|
* @ingroup themeable
|
|
|
|
*/
|
|
|
|
#}
|
2014-10-08 10:52:46 +00:00
|
|
|
{%
|
|
|
|
set classes = [
|
|
|
|
title_display == 'after' ? 'option',
|
|
|
|
title_display == 'invisible' ? 'visually-hidden',
|
|
|
|
required ? 'form-required',
|
|
|
|
]
|
|
|
|
%}
|
Issue #2152215 by joelpittet, mr.baileys, benjifisher, martin107, rteijeiro, hussainweb, shanethehat, jenlampton, kpa, AnythonyR, EVIIILJ, kgoel, Cottser, dsdeiz, hanpersand, bayousoft: Convert theme_form_element_label() to Twig
2014-06-12 17:20:10 +00:00
|
|
|
{% if title is not empty or required -%}
|
2014-10-08 10:52:46 +00:00
|
|
|
<label{{ attributes.addClass(classes) }}>{{ title }}</label>
|
Issue #2152215 by joelpittet, mr.baileys, benjifisher, martin107, rteijeiro, hussainweb, shanethehat, jenlampton, kpa, AnythonyR, EVIIILJ, kgoel, Cottser, dsdeiz, hanpersand, bayousoft: Convert theme_form_element_label() to Twig
2014-06-12 17:20:10 +00:00
|
|
|
{%- endif %}
|