orange_starter-2.0.x-dev/templates/input/form-element-label.html.twig

templates/input/form-element-label.html.twig
{#
/**
 * @file
 * Default theme implementation for a form element label.
 *
 * Available variables:
 * - element: an input element.
 * - title: The label's text.
 * - title_display: Elements title_display setting.
 * - description: element description.
 * - 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 templates
 */
#}
{# Check for the address line 2 field. #}
{% if (element_id) and ('address-line2' in element_id) %}
  {% set is_address_line2 = true %}
  {% set label_text = 'Apartment, suite, etc.'|t %}
  {% set title = label_text %}
{% else %}
  {% set title = title %}
{% endif %}
{%
  set classes = [
    'control-label',
    title_display == 'after' ? 'option',
    not is_address_line2 and title_display == 'invisible' ? 'sr-only',
    required ? 'js-form-required',
  ]
%}
{%
  set attributes = attributes.addClass(classes)
%}
{#
  If the label already has the class 'js-form-required' then set the boolean
  as expected. See \Drupal\commerce_authnet\PluginForm\AcceptJs\PaymentMethodAddForm::buildCreditCardForm().
#}
{%
  set required = attributes.hasClass('js-form-required')
%}
{% if title is not empty %}
  <label{{ attributes }}>{{ element }}{{ title }}
    {% if required and (title_display == 'before' or title_display == 'after') %}
      <span class="form-required"> *</span>
    {% else %}
      {% if (element_type != 'radio') and (element_type != 'checkbox') %}
        <span class="form-optional {{ not is_address_line2 and title_display == 'invisible' ? 'sr-only' : '' }}"> - {{ 'Optional'|t }}</span>
      {% endif %}
    {% endif %}
  </label>
{% endif %}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc