@@ -785,9 +785,40 @@ to just one field) are rendered separately, usually at the top of your form:
785
785
<?php echo $view['form']->render($form); ?>
786
786
787
787
To customize *only * the markup used for these errors, follow the same directions
788
- as above, but now call the block ``form_errors `` (Twig) / the file ``form_errors.html.php ``
789
- (PHP). Now, when errors for the ``form `` type are rendered, your customized
790
- fragment will be used instead of the default ``form_errors ``.
788
+ as above, but now check if the ``compound `` attribute is set to ``true ``:
789
+
790
+ ..configuration-block ::
791
+
792
+ ..code-block ::html+jinja
793
+
794
+ {# form_errors.html.twig #}
795
+ {% block form_errors %}
796
+ {% spaceless %}
797
+ {% if errors|length > 0 %}
798
+ {% if compound %}
799
+ <ul>
800
+ {% for error in errors %}
801
+ <li>{{ error.message }}</li>
802
+ {% endfor %}
803
+ </ul>
804
+ {% endif %}
805
+ {% endif %}
806
+ {% endspaceless %}
807
+ {% endblock form_errors %}
808
+
809
+ ..code-block ::html+php
810
+
811
+ <!-- form_errors.html.php -->
812
+ <?php if ($errors): ?>
813
+ <?php if ($compound): ?>
814
+ <ul>
815
+ <?php foreach ($errors as $error): ?>
816
+ <li><?php echo $error->getMessage() ?></li>
817
+ <?php endforeach; ?>
818
+ </ul>
819
+ <?php endif; ?>
820
+ <?php endif ?>
821
+
791
822
792
823
Customizing the "Form Row"
793
824
~~~~~~~~~~~~~~~~~~~~~~~~~~