annotate core/modules/system/templates/form-element-label.html.twig @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 {#
Chris@0 2 /**
Chris@0 3 * @file
Chris@0 4 * Default theme implementation for a form element label.
Chris@0 5 *
Chris@0 6 * Available variables:
Chris@0 7 * - title: The label's text.
Chris@0 8 * - title_display: Elements title_display setting.
Chris@0 9 * - required: An indicator for whether the associated form element is required.
Chris@0 10 * - attributes: A list of HTML attributes for the label.
Chris@0 11 *
Chris@0 12 * @see template_preprocess_form_element_label()
Chris@0 13 *
Chris@0 14 * @ingroup themeable
Chris@0 15 */
Chris@0 16 #}
Chris@0 17 {%
Chris@0 18 set classes = [
Chris@0 19 title_display == 'after' ? 'option',
Chris@0 20 title_display == 'invisible' ? 'visually-hidden',
Chris@0 21 required ? 'js-form-required',
Chris@0 22 required ? 'form-required',
Chris@0 23 ]
Chris@0 24 %}
Chris@0 25 {% if title is not empty or required -%}
Chris@0 26 <label{{ attributes.addClass(classes) }}>{{ title }}</label>
Chris@0 27 {%- endif %}