Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ae6ff6b

Browse files
committed
feature #7566 Add login_form_footer block to the login page template (lacatoire)
This PR was submitted for the 4.x branch but it was merged into the 5.x branch instead. Discussion ---------- Add login_form_footer block to the login page template Adds an empty `login_form_footer` Twig block right after the `</form>` element in `templates/page/login.html.twig` so applications can render additional markup (disclaimer, terms of service, extra link) without copying the whole template. Documented in `doc/dashboards.rst` next to the other login page options. Closes #7544 Commits ------- f6c3309 Add login_form_footer block to the login page template
2 parents aff99c2 + f6c3309 commit ae6ff6b

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

doc/dashboards.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,29 @@ applications can rely on its default values::
10901090
}
10911091
}
10921092

1093+
The template exposes a ``login_form_footer`` Twig block right after the form
1094+
and before the inline login script, to render additional markup (for instance
1095+
a disclaimer or a link to the terms of service). Create your own template
1096+
that extends the login template and override the block:
1097+
1098+
.. code-block:: twig
1099+
1100+
{# templates/security/login.html.twig #}
1101+
{% extends '@EasyAdmin/page/login.html.twig' %}
1102+
1103+
{% block login_form_footer %}
1104+
<p class="text-center mt-3">
1105+
<a href="{{ path('terms') }}">Terms of Service</a>
1106+
</p>
1107+
{% endblock %}
1108+
1109+
Then update your security controller to render this custom template instead
1110+
of ``@EasyAdmin/page/login.html.twig`` (or override EasyAdmin's template
1111+
globally by placing the override at
1112+
``templates/bundles/EasyAdminBundle/page/login.html.twig`` and extending
1113+
``@!EasyAdmin/page/login.html.twig``, which keeps the original login
1114+
controller untouched).
1115+
10931116
.. _content_page_template:
10941117

10951118
Content Page Template

templates/page/login.html.twig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@
9292
<twig:ea:Button type="submit" variant="primary" size="lg" isBlock htmlAttributes="{class: 'btn-block'}">{{ _sign_in_label }}</twig:ea:Button>
9393
</form>
9494

95+
{% block login_form_footer %}{% endblock login_form_footer %}
96+
9597
{% guard function csp_nonce %}
9698
<script src="{{ asset('login.js', constant('EasyCorp\\Bundle\\EasyAdminBundle\\Asset\\AssetPackage::PACKAGE_NAME')) }}" nonce="{{ csp_nonce('script') }}"></script>
9799
{% else %}

0 commit comments

Comments
 (0)