You are here

form-element-label--switch.html.twig in Open Social 8

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.

File

themes/socialbase/templates/form/form-element-label--switch.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for a form element label.
  5. *
  6. * Available variables:
  7. * - element: an input element.
  8. * - title: The label's text.
  9. * - title_display: Elements title_display setting.
  10. * - description: element description.
  11. * - required: An indicator for whether the associated form element is required.
  12. * - attributes: A list of HTML attributes for the label.
  13. *
  14. * @see template_preprocess_form_element_label()
  15. *
  16. * @ingroup templates
  17. */
  18. #}
  19. {%- if title is not empty -%}
  20. <div class="switch__label">
  21. {{ title }}
  22. {%- if required -%}
  23. <span class="form-required">*</span>
  24. {%- endif -%}
  25. </div>
  26. <div class="switch__options">
  27. {%- trans -%} Off {%- endtrans -%}
  28. {{ element }}
  29. <span class="lever"></span>
  30. {%- trans -%} On {%- endtrans -%}
  31. {{ children }}
  32. </div>
  33. {%- endif -%}