Created
October 23, 2015 04:06
-
-
Save perk11/a63e15f38f8aeb8381f3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
{% block checkbox_radio_label %} | |
{# Do not display the label if widget is not defined in order to prevent double label rendering #} | |
{% if widget is defined %} | |
{% if required %} | |
{% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) %} | |
{% endif %} | |
{% if parent_label_class is defined %} | |
{% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ parent_label_class)|trim}) %} | |
{% endif %} | |
{% if label is not sameas(false) and label is empty %} | |
{% set label = name|humanize %} | |
{% endif %} | |
<label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}> | |
{{- widget|raw -}} | |
{{- label is not sameas(false) ? label|trans({}, translation_domain) -}} | |
</label> | |
{% endif %} | |
{% endblock checkbox_radio_label %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment