|
@@ -12,35 +12,42 @@ file that was distributed with this source code.
|
|
|
{# Labels #}
|
|
|
{% block form_label %}
|
|
|
{% spaceless %}
|
|
|
+ {% set label_attr = label_attr|merge({'class': label_attr.class|default('') ~ " control-label" }) %}
|
|
|
+
|
|
|
{% if not compound %}
|
|
|
- {% set attr = attr|merge({'for': id}) %}
|
|
|
+ {% set label_attr = label_attr|merge({'for': id}) %}
|
|
|
{% endif %}
|
|
|
{% if required %}
|
|
|
- {% set attr = attr|merge({'class': attr.class|default('') ~ ' required'}) %}
|
|
|
+ {% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' required')|trim}) %}
|
|
|
+ {% endif %}
|
|
|
+
|
|
|
+ {% if label is empty %}
|
|
|
+ {% set label = name|humanize %}
|
|
|
{% endif %}
|
|
|
+
|
|
|
{% if in_list_checkbox is defined and in_list_checkbox and widget is defined %}
|
|
|
<label{% for attrname,attrvalue in attr %} {{attrname}}="{{attrvalue}}"{% endfor %}>
|
|
|
{{ widget|raw }}
|
|
|
<span>
|
|
|
{% if not sonata_admin.admin%}
|
|
|
- {{- label -}}
|
|
|
+ {{- label|trans({}, translation_domain) -}}
|
|
|
{% else %}
|
|
|
{{- label|trans({}, sonata_admin.admin.translationDomain) -}}
|
|
|
{% endif%}
|
|
|
</span>
|
|
|
</label>
|
|
|
{% else %}
|
|
|
- <label{% for attrname,attrvalue in attr %} {{attrname}}="{{attrvalue}}"{% endfor %}>
|
|
|
+ <label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>
|
|
|
{% if not sonata_admin.admin%}
|
|
|
- {{ label }}
|
|
|
+ {{- label|trans({}, translation_domain) -}}
|
|
|
{% else %}
|
|
|
- {{ label|trans({}, sonata_admin.admin.translationDomain) }}
|
|
|
+ {{- label|trans({}, sonata_admin.admin.translationDomain) -}}
|
|
|
{% endif%}
|
|
|
{{ required ? '*' : '' }}
|
|
|
</label>
|
|
|
{% endif %}
|
|
|
{% endspaceless %}
|
|
|
-{% endblock %}
|
|
|
+{% endblock form_label %}
|
|
|
|
|
|
{% block widget_container_attributes_choice_widget %}
|
|
|
{% spaceless %}
|
|
@@ -50,13 +57,26 @@ file that was distributed with this source code.
|
|
|
{% endspaceless %}
|
|
|
{% endblock %}
|
|
|
|
|
|
+{% block choice_widget_expanded %}
|
|
|
+{% spaceless %}
|
|
|
+ <ul {{ block('widget_container_attributes') }}>
|
|
|
+ {% for child in form %}
|
|
|
+ <li>
|
|
|
+ {{ form_widget(child) }}
|
|
|
+ {{ form_label(child) }}
|
|
|
+ </li>
|
|
|
+ {% endfor %}
|
|
|
+ </ul>
|
|
|
+{% endspaceless %}
|
|
|
+{% endblock choice_widget_expanded %}
|
|
|
+
|
|
|
{% block choice_widget %}
|
|
|
{% spaceless %}
|
|
|
{% if expanded %}
|
|
|
<ul {{ block('widget_container_attributes_choice_widget') }}>
|
|
|
{% for child in form %}
|
|
|
<li>
|
|
|
- {{ form_label(child, null, { 'in_list_checkbox' : true, 'widget' : form_widget(child) } ) }}
|
|
|
+ {{ form_label(child, child.vars.label|default(null), { 'in_list_checkbox' : true, 'widget' : form_widget(child) } ) }}
|
|
|
</li>
|
|
|
{% endfor %}
|
|
|
</ul>
|
|
@@ -88,7 +108,7 @@ file that was distributed with this source code.
|
|
|
{% if sonata_admin.field_description.options.name is defined %}
|
|
|
{{ form_label(form, sonata_admin.field_description.options.name, { 'attr' : {'class' : 'control-label'} }) }}
|
|
|
{% else %}
|
|
|
- {{ form_label(form, null, { 'attr' : {'class' : 'control-label'} }) }}
|
|
|
+ {{ form_label(form, label|default(null), { 'attr' : {'class' : 'control-label'} }) }}
|
|
|
{% endif %}
|
|
|
{% endblock %}
|
|
|
|