浏览代码

Update form_errors block

Emmanuel Vella 10 年之前
父节点
当前提交
389df080dd
共有 1 个文件被更改,包括 12 次插入0 次删除
  1. 12 0
      Resources/views/Form/form_admin_fields.html.twig

+ 12 - 0
Resources/views/Form/form_admin_fields.html.twig

@@ -11,6 +11,18 @@ file that was distributed with this source code.
 
 {% extends 'form_div_layout.html.twig' %}
 
+{% block form_errors -%}
+    {% if errors|length > 0 %}
+        {% if not form.parent %}<div class="alert alert-danger">{% endif %}
+            <ul class="list-unstyled">
+                {% for error in errors %}
+                    <li><i class="glyphicon glyphicon-exclamation-sign"></i> {{ error.message }}</li>
+                {% endfor %}
+            </ul>
+        {% if not form.parent %}</div>{% endif %}
+    {% endif %}
+{%- endblock form_errors %}
+
 {% block form_widget -%}
     {{ parent() }}
     {% if sonata_help is defined and sonata_help %}