Jelajahi Sumber

Merge pull request #2784 from EmmanuelVella/admin-pool

Check if admin_pool is defined in admin form template
Thomas 10 tahun lalu
induk
melakukan
69ea825525
1 mengubah file dengan 3 tambahan dan 3 penghapusan
  1. 3 3
      Resources/views/Form/form_admin_fields.html.twig

+ 3 - 3
Resources/views/Form/form_admin_fields.html.twig

@@ -63,7 +63,7 @@ file that was distributed with this source code.
 {# Labels #}
 {# Labels #}
 {% block form_label %}
 {% block form_label %}
 {% spaceless %}
 {% spaceless %}
-    {% if label is not sameas(false) and admin_pool.getOption('form_type') == 'horizontal' %}
+    {% if label is not sameas(false) and admin_pool is defined and admin_pool.getOption('form_type') == 'horizontal' %}
         {% set label_class = 'col-sm-3' %}
         {% set label_class = 'col-sm-3' %}
     {% endif %}
     {% endif %}
 
 
@@ -167,7 +167,7 @@ file that was distributed with this source code.
             {% set div_class = div_class ~ ' sonata-collection-row-without-label' %}
             {% set div_class = div_class ~ ' sonata-collection-row-without-label' %}
         {% endif %}
         {% endif %}
 
 
-        {% if admin_pool.getOption('form_type') == 'horizontal' %}
+        {% if admin_pool is defined and admin_pool.getOption('form_type') == 'horizontal' %}
             {% if label is sameas(false) %}
             {% if label is sameas(false) %}
                 {% if 'collection' in form.parent.vars.block_prefixes %}
                 {% if 'collection' in form.parent.vars.block_prefixes %}
                     {% set div_class = div_class ~ ' col-sm-12' %}
                     {% set div_class = div_class ~ ' col-sm-12' %}
@@ -266,7 +266,7 @@ file that was distributed with this source code.
             {{ form_label(child) }}
             {{ form_label(child) }}
 
 
             {% set div_class = "" %}
             {% set div_class = "" %}
-            {% if admin_pool.getOption('form_type') == 'horizontal' %}
+            {% if admin_pool is defined and admin_pool.getOption('form_type') == 'horizontal' %}
                 {% set div_class = 'col-sm-9' %}
                 {% set div_class = 'col-sm-9' %}
             {% endif%}
             {% endif%}