templates - Reuse form in actions "New" and "Edit" -
i have actions "new" , "edit". want reuse same template in both actions. problem is, when i'm creating new entity, want show "new entity" in page title. when i'm editing entity want "editing entity title".
i pass variable in each action indicating action don't feel right doing ... there way detect if it's creation or edition in twig?
how solve common issue?
you can pass entity view , create variable in twig
{% set isnew = not entity.id > 0 %}
easy?
if want pass form view can entity directly form
{% set entity = form.get('value') %}
Comments
Post a Comment