file form-element-label.html.twig

Theme override to display 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.

File

templates/form/form-element-label.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Theme override to display a form element label.
  5. *
  6. * Available variables:
  7. * - title: The label's text.
  8. * - title_display: Elements title_display setting.
  9. * - required: An indicator for whether the associated form element is required.
  10. * - attributes: A list of HTML attributes for the label.
  11. *
  12. * @see template_preprocess_form_element_label()
  13. *
  14. * @ingroup uikit_themeable
  15. */
  16. #}
  17. {%
  18. set classes = [
  19. title_display == 'before' ? 'uk-form-label',
  20. title_display == 'invisible' ? 'visually-hidden',
  21. ]
  22. %}
  23. {% if title is not empty or required -%}
  24. <label{{ attributes.addClass(classes) }}>{{ title }}{% if required %} <sup class="form-required uk-text-danger">*</sup>{% endif %}</label>
  25. {%- endif %}

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Log in