-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update form label template
- Loading branch information
Showing
3 changed files
with
43 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
templates/form/form-element-label--design-system.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{# | ||
/** | ||
* @file | ||
* Theme override for 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. | ||
* | ||
* @see template_preprocess_form_element_label() | ||
*/ | ||
#} | ||
{% | ||
set classes = [ | ||
title_display == 'after' ? 'option', | ||
title_display == 'invisible' ? 'visually-hidden', | ||
required ? 'js-form-required', | ||
required ? 'form-required', | ||
'au-control-input__text', | ||
] | ||
%} | ||
{% if title is not empty or required -%} | ||
<label{{ attributes.addClass(classes) }}>{{ title }}</label> | ||
{%- endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters