From 19166fe3807a85c5a0f2a27dc1bc97f56f68b889 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Fr=C3=A9mont?= Date: Fri, 24 Oct 2025 17:00:09 +0200 Subject: [PATCH] [Ui] Add a full layout --- config/reference.php | 4 +++ config/routes.yaml | 12 +++++++ config/sylius/twig_hooks/page.php | 30 ++++++++++++++++ .../templates/layout/full_layout.html.twig | 23 ++++++++++++ .../app/twig_hooks/layout/full_layout.php | 36 +++++++++++++++++++ templates/page/simple.html.twig | 15 ++++++++ templates/page/with_hooks.html.twig | 3 ++ templates/page/with_hooks/body.html.twig | 11 ++++++ 8 files changed, 134 insertions(+) create mode 100644 config/sylius/twig_hooks/page.php create mode 100644 src/AdminUi/templates/layout/full_layout.html.twig create mode 100644 src/BootstrapAdminUi/config/app/twig_hooks/layout/full_layout.php create mode 100644 templates/page/simple.html.twig create mode 100644 templates/page/with_hooks.html.twig create mode 100644 templates/page/with_hooks/body.html.twig diff --git a/config/reference.php b/config/reference.php index 28286634..8aca308e 100644 --- a/config/reference.php +++ b/config/reference.php @@ -767,6 +767,7 @@ * } * @psalm-type LiveComponentConfig = array{ * secret?: scalar|Param|null, // The secret used to compute fingerprints and checksums // Default: "%kernel.secret%" + * fetch_credentials?: "same-origin"|"include"|"omit"|Param, // The default fetch credentials mode for all Live Components ('same-origin', 'include', 'omit') // Default: "same-origin" * } * @psalm-type StimulusConfig = array{ * controller_paths?: list, @@ -1474,6 +1475,9 @@ * path?: scalar|Param|null, // The local icon set directory path. (cannot be used with 'alias') * alias?: scalar|Param|null, // The remote icon set identifier. (cannot be used with 'path') * icon_attributes?: array, + * suffixes?: array, + * }>, * }>, * aliases?: array, * iconify?: bool|array{ // Configuration for the remote icon service. diff --git a/config/routes.yaml b/config/routes.yaml index bb6939d7..16eac8b3 100644 --- a/config/routes.yaml +++ b/config/routes.yaml @@ -3,3 +3,15 @@ index: controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController defaults: template: base.html.twig + +admin_simple_page: + path: /admin/page/simple + controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController + defaults: + template: 'page/simple.html.twig' + +admin_page_with_hooks: + path: /admin/page/with-hooks + controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController + defaults: + template: 'page/with_hooks.html.twig' diff --git a/config/sylius/twig_hooks/page.php b/config/sylius/twig_hooks/page.php new file mode 100644 index 00000000..80c69311 --- /dev/null +++ b/config/sylius/twig_hooks/page.php @@ -0,0 +1,30 @@ +extension('sylius_twig_hooks', [ + 'hooks' => [ + 'app.page#navbar' => [ + 'content' => [ + 'enabled' => false, + ], + ], + 'app.page#main' => [ + 'body' => [ + 'template' => 'page/with_hooks/body.html.twig', + ], + ], + ], + ]); +}; diff --git a/src/AdminUi/templates/layout/full_layout.html.twig b/src/AdminUi/templates/layout/full_layout.html.twig new file mode 100644 index 00000000..71a15ba2 --- /dev/null +++ b/src/AdminUi/templates/layout/full_layout.html.twig @@ -0,0 +1,23 @@ +{% extends '@SyliusAdminUi/base.html.twig' %} + +{% set prefixes = prefixes|default({})|merge([ + 'sylius_admin.common.full_layout', +]) %} + +{% block body %} + {% block sidebar %} + {% hook '#sidebar' with {_prefixes: prefixes} %} + {% endblock %} + + {% block navbar %} + {% hook '#navbar' with {_prefixes: prefixes} %} + {% endblock %} + + {% block main %} + {% hook '#main' with {_prefixes: prefixes} %} + {% endblock %} + + {% block footer %} + {% hook '#footer' with {_prefixes: prefixes} %} + {% endblock %} +{% endblock %} diff --git a/src/BootstrapAdminUi/config/app/twig_hooks/layout/full_layout.php b/src/BootstrapAdminUi/config/app/twig_hooks/layout/full_layout.php new file mode 100644 index 00000000..2d0b1999 --- /dev/null +++ b/src/BootstrapAdminUi/config/app/twig_hooks/layout/full_layout.php @@ -0,0 +1,36 @@ +extension('sylius_twig_hooks', [ + 'hooks' => [ + 'sylius_admin.common.full_layout#sidebar' => [ + 'content' => [ + 'template' => '@SyliusBootstrapAdminUi/shared/crud/common/sidebar.html.twig', + ], + ], + 'sylius_admin.common.full_layout#navbar' => [ + 'content' => [ + 'template' => '@SyliusBootstrapAdminUi/shared/crud/common/navbar.html.twig', + ], + ], + 'sylius_admin.common.full_layout#footer' => [ + 'content' => [ + 'template' => '@SyliusBootstrapAdminUi/shared/crud/common/content/footer.html.twig', + ], + ], + ], + ]); +}; diff --git a/templates/page/simple.html.twig b/templates/page/simple.html.twig new file mode 100644 index 00000000..31ff533a --- /dev/null +++ b/templates/page/simple.html.twig @@ -0,0 +1,15 @@ +{% extends '@SyliusAdminUi/layout/full_layout.html.twig' %} + +{% block main %} +
+
+
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ac felis nec sapien interdum luctus. Integer non sapien in urna faucibus pharetra. Vivamus vitae justo at arcu gravida aliquam. Sed congue eros id dolor faucibus, in iaculis arcu lacinia.

+

Section

+

Phasellus euismod, justo in facilisis lacinia, massa arcu convallis libero, sed consequat dolor nisl sit amet libero. Aenean euismod sem vel turpis ultrices, vitae laoreet leo sodales.

+
+
+
+
+{% endblock %} diff --git a/templates/page/with_hooks.html.twig b/templates/page/with_hooks.html.twig new file mode 100644 index 00000000..1fc3c17a --- /dev/null +++ b/templates/page/with_hooks.html.twig @@ -0,0 +1,3 @@ +{% extends '@SyliusAdminUi/layout/full_layout.html.twig' %} + +{% set prefixes = ['app.page'] %} diff --git a/templates/page/with_hooks/body.html.twig b/templates/page/with_hooks/body.html.twig new file mode 100644 index 00000000..acc58d18 --- /dev/null +++ b/templates/page/with_hooks/body.html.twig @@ -0,0 +1,11 @@ +
+
+
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ac felis nec sapien interdum luctus. Integer non sapien in urna faucibus pharetra. Vivamus vitae justo at arcu gravida aliquam. Sed congue eros id dolor faucibus, in iaculis arcu lacinia.

+

Section

+

Phasellus euismod, justo in facilisis lacinia, massa arcu convallis libero, sed consequat dolor nisl sit amet libero. Aenean euismod sem vel turpis ultrices, vitae laoreet leo sodales.

+
+
+
+