Skip to content

Commit

Permalink
[TwigBridge] Use label_format option for checkbox and radio labels
Browse files Browse the repository at this point in the history
  • Loading branch information
enumag committed Jan 14, 2016
1 parent 07673dc commit dc8f780
Showing 1 changed file with 8 additions and 1 deletion.
Expand Up @@ -167,7 +167,14 @@
{% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ parent_label_class)|trim}) %}
{% endif %}
{% if label is not same as(false) and label is empty %}
{% set label = name|humanize %}
{%- if label_format is not empty -%}
{% set label = label_format|replace({
'%name%': name,
'%id%': id,
}) %}
{%- else -%}
{% set label = name|humanize %}
{%- endif -%}
{% endif %}
<label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>
{{- widget|raw }} {{ label is not same as(false) ? (translation_domain is same as(false) ? label : label|trans({}, translation_domain)) -}}
Expand Down

0 comments on commit dc8f780

Please sign in to comment.