File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -204,20 +204,18 @@ array).
204
204
rootform
205
205
~~~~~~~~
206
206
207
- This test will check for sure if the current ``form `` does not have a parent form view.
208
- It would avoid collision and odd behavior when your form has defined a ``parent `` field.
207
+ This test will check if the current ``form `` does not have a parent form view.
209
208
210
- Wrong example if your form has a field named `` parent ``:
209
+ .. code-block :: twig
211
210
212
- .. code-block :: jinja
211
+ {# DON'T DO THIS: this code will fail when the form doesn't have a parent
212
+ but it defines a normal form field called 'parent' #}
213
213
214
214
{% if form.parent is null %}
215
215
{{ form_errors(form) }}
216
216
{% endif %}
217
217
218
- Correct example, this will check for the parent form view rather than its ``parent `` field:
219
-
220
- .. code-block :: jinja
218
+ {# DO THIS: this code will always work, regardless of the form field names #}
221
219
222
220
{% if form is rootform %}
223
221
{{ form_errors(form) }}
You can’t perform that action at this time.
0 commit comments