[TwigBridge] Use label_format option for checkbox and radio labels
This commit is contained in:
parent
07673dcd38
commit
dc8f780f6b
@ -167,7 +167,14 @@
|
|||||||
{% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ parent_label_class)|trim}) %}
|
{% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ parent_label_class)|trim}) %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if label is not same as(false) and label is empty %}
|
{% if label is not same as(false) and label is empty %}
|
||||||
|
{%- if label_format is not empty -%}
|
||||||
|
{% set label = label_format|replace({
|
||||||
|
'%name%': name,
|
||||||
|
'%id%': id,
|
||||||
|
}) %}
|
||||||
|
{%- else -%}
|
||||||
{% set label = name|humanize %}
|
{% set label = name|humanize %}
|
||||||
|
{%- endif -%}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>
|
<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)) -}}
|
{{- widget|raw }} {{ label is not same as(false) ? (translation_domain is same as(false) ? label : label|trans({}, translation_domain)) -}}
|
||||||
|
Reference in New Issue
Block a user