Closed
Description
How can know if a form has a parent or not, in a view?
The fast answer is:
{{ form.parent }}
but if the form has a child called parent
the above statement always return a result, even when they do not have a real parent.
then the only way to know if has a real parent is something like:
{% set hasParent = (form.parent is not null and (not form.offsetExists('parent') or form.parent != form.offsetGet('parent'))) %}
I'm missing something?
a method hasParent()
is needed in the FormView to avoid the \ArrayAccess.
Metadata
Metadata
Assignees
Labels
Ideal for your first contribution! (some Symfony experience may be required)Ideal for your first contribution! (some Symfony experience may be required)