Skip to content

Commit e3b20d8

Browse files
committed
Minor rewording. Added tip about meaning of compound var and expanded
the example code to contain `else` statements.
1 parent 1e278c4 commit e3b20d8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

cookbook/form/form_customization.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,13 @@ field) are rendered separately, usually at the top of your form:
794794
<?php echo $view['form']->render($form); ?>
795795
796796
To customize *only* the markup used for these errors, follow the same directions
797-
as above, but now check if the ``compound`` attribute is set to ``true``:
797+
as above, but now check if the ``compound`` variable is set to ``true``.
798+
799+
.. tip::
800+
801+
If the ``compound`` variable is ``true``, it means that what's being
802+
currently rendered is a collection of fields (e.g. a whole form), and not
803+
just an individual field.
798804

799805
.. configuration-block::
800806

@@ -810,6 +816,8 @@ as above, but now check if the ``compound`` attribute is set to ``true``:
810816
<li>{{ error.message }}</li>
811817
{% endfor %}
812818
</ul>
819+
{% else %}
820+
{# display the errors for a single field #}
813821
{% endif %}
814822
{% endif %}
815823
{% endspaceless %}
@@ -825,6 +833,8 @@ as above, but now check if the ``compound`` attribute is set to ``true``:
825833
<li><?php echo $error->getMessage() ?></li>
826834
<?php endforeach; ?>
827835
</ul>
836+
<?php else: ?>
837+
<?php // render the errors for a single field ?>
828838
<?php endif; ?>
829839
<?php endif ?>
830840

0 commit comments

Comments
 (0)