Created
February 3, 2019 11:16
-
-
Save parap/0d16012a45c233e7fdf2c2a4e90850e2 to your computer and use it in GitHub Desktop.
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
{% form_theme form _self %} | |
{# modified bootstrap_4 scheme to display checkbox label begins #} | |
{% block checkbox_radio_label -%} | |
<label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}> | |
{{- label is not same as(false) ? (translation_domain is same as(false) ? label : label|trans({}, translation_domain)) -}} | |
{{- form_errors(form) -}} | |
</label> | |
{%- if widget is defined -%} | |
{% set is_parent_custom = parent_label_class is defined and ('checkbox-custom' in parent_label_class or 'radio-custom' in parent_label_class) %} | |
{% set is_custom = label_attr.class is defined and ('checkbox-custom' in label_attr.class or 'radio-custom' in label_attr.class) %} | |
{%- if is_parent_custom or is_custom -%} | |
{%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' custom-control-label')|trim}) -%} | |
{%- else %} | |
{%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' form-check-label')|trim}) -%} | |
{%- endif %} | |
{%- if not compound -%} | |
{% set label_attr = label_attr|merge({'for': id}) %} | |
{%- endif -%} | |
{%- 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)|replace({'checkbox-inline': '', 'radio-inline': '', 'checkbox-custom': '', 'radio-custom': ''})|trim}) -%} | |
{%- endif -%} | |
{%- if label is not same as(false) and label is empty -%}K3 | |
{%- if label_format is not empty -%} | |
{%- set label = label_format|replace({ | |
'%name%': name, | |
'%id%': id, | |
}) -%} | |
{%- else -%} | |
{%- set label = name|humanize -%} | |
{%- endif -%} | |
{%- endif -%} | |
{{ widget|raw }} | |
{%- endif -%} | |
{%- endblock checkbox_radio_label -%} | |
{# modified bootstrap_4 scheme to display checkbox label ends #} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment