From 21f7f09c632210e598672b81635f7a4c33b4f5ca Mon Sep 17 00:00:00 2001 From: Maxime Huran Date: Thu, 19 Jan 2023 11:21:51 +0100 Subject: [PATCH] Display Update toolbar only in update context --- src/Resources/config/routing/admin.yaml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/Resources/config/routing/admin.yaml b/src/Resources/config/routing/admin.yaml index 866af25..07fbe80 100644 --- a/src/Resources/config/routing/admin.yaml +++ b/src/Resources/config/routing/admin.yaml @@ -4,7 +4,7 @@ monsieurbiz_sylius_cms_page_admin: alias: monsieurbiz_cms_page.page section: admin templates: "@SyliusAdmin\\Crud" - except: ['show'] + except: ['show', 'update'] redirect: update grid: monsieurbiz_cms_page vars: @@ -12,7 +12,6 @@ monsieurbiz_sylius_cms_page_admin: subheader: monsieurbiz_cms_page.ui.pages_subheader templates: form: "@MonsieurBizSyliusCmsPagePlugin/Admin/Page/_form.html.twig" - toolbar: "@MonsieurBizSyliusCmsPagePlugin/Admin/Page/Update/_toolbar.html.twig" index: icon: 'file alternate' type: sylius.resource @@ -24,3 +23,20 @@ monsieurbiz_sylius_cms_page_ajax_generate_page_slug: defaults: _controller: MonsieurBiz\SyliusCmsPagePlugin\Controller\Admin\Page\PageSlugController::generateAction + +monsieurbiz_cms_page_admin_page_update: + path: /pages/{id}/edit + methods: [GET, PUT, PATCH] + defaults: + _controller: monsieurbiz_cms_page.controller.page:updateAction + _sylius: + section: admin + permission: true + redirect: referer + template: "@SyliusAdmin/Crud/update.html.twig" + vars: + subheader: monsieurbiz_cms_page.ui.pages_subheader + icon: file alternate + templates: + form: "@MonsieurBizSyliusCmsPagePlugin/Admin/Page/_form.html.twig" + toolbar: "@MonsieurBizSyliusCmsPagePlugin/Admin/Page/Update/_toolbar.html.twig"