eZ Platform Discussions

[Form Builder] customise the form_submit_message.html.twig ( LP / Form view full )



I have a form with a button configured to display a congratulatory message after the submission.

To customize the message template I created a file form_submit_message.html.twig in themes/my_theme/form_builder

{% extends "MyBundle::pagelayout_header_content_aside.html.twig" %}

{% block content_header %}
    <h1>{{ ez_content_name(content) }}</h1>
{% endblock %}

{% block content_body %}
    <h2>{{ submit_message }}</h2> {# Le message administré dans le boutton #}
    {{ ez_render_field(content, 'confirm') }} {# Le message en texte riche administré dans le content Form #}
{% endblock %}

Obviously, I didn’t work on my form in a landing_page…
My ContentType Form is handle as normal page with a full view and you can access the form through its URL.

So, to display the message I make an extends of my pagelayout.

But now I want my forms to be able to be displayed in a landing page as well.

And as a result. When I submit the form from an LP. I have all the success page (with the pagelayout) that is displayed in my LP.

And the variable noLayout is well available in the template… But it is always false

{% if not noLayout|default(false) %} {# !! noLayout is always `false` #}
    {% extends "EdbPressePro3Bundle::pagelayout_header_content_aside.html.twig" %}
{% endif %}

How do I know if I should do the extends or not?


I noticed that the form variable is only available in the full view of the form.

But I don’t understand why that: it doesn’t work…

{% if form|default(false) %} {# form only aviable in form view full #}
    {% extends "MyBundle::pagelayout_header_content_aside.html.twig" %}
{% endif %}

Whether the variable is available or not, the extends is always applied.