From 466151540afce0cfdb200ab250536cd4cf50da9e Mon Sep 17 00:00:00 2001 From: Christoph Wieseke Date: Mon, 15 Apr 2024 17:53:14 +0200 Subject: [PATCH] [LeadGenerationBundle] fixed route and type handling --- .../AdminList/PopupAdminListConfigurator.php | 14 ++++++++++++++ .../Controller/PopupsAdminListController.php | 4 +++- .../Controller/RulesAdminListController.php | 4 +++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/Kunstmaan/LeadGenerationBundle/AdminList/PopupAdminListConfigurator.php b/src/Kunstmaan/LeadGenerationBundle/AdminList/PopupAdminListConfigurator.php index 13c651b80c..943cb1bef9 100644 --- a/src/Kunstmaan/LeadGenerationBundle/AdminList/PopupAdminListConfigurator.php +++ b/src/Kunstmaan/LeadGenerationBundle/AdminList/PopupAdminListConfigurator.php @@ -104,4 +104,18 @@ public function canAdd() { return true; } + + /** + * @param string|null $suffix + * + * @return string + */ + public function getPathByConvention($suffix = null) + { + if (null === $suffix || $suffix === '') { + return 'kunstmaanleadgenerationbundle_admin_popup_abstractpopup'; + } + + return sprintf('kunstmaanleadgenerationbundle_admin_popup_abstractpopup_%s', $suffix); + } } diff --git a/src/Kunstmaan/LeadGenerationBundle/Controller/PopupsAdminListController.php b/src/Kunstmaan/LeadGenerationBundle/Controller/PopupsAdminListController.php index 846022138f..fd1391a869 100644 --- a/src/Kunstmaan/LeadGenerationBundle/Controller/PopupsAdminListController.php +++ b/src/Kunstmaan/LeadGenerationBundle/Controller/PopupsAdminListController.php @@ -64,7 +64,9 @@ public function editAction(Request $request, $id): Response #[Route(path: '/add', name: 'kunstmaanleadgenerationbundle_admin_popup_abstractpopup_add', methods: ['GET', 'POST'])] public function addAction(Request $request): Response { - $type = $request->query->get('type'); + $type = $request->isMethod('post') + ? $request->request->get('type') + : $request->query->get('type'); return parent::doAddAction($this->getAdminListConfigurator(), $type, $request); } diff --git a/src/Kunstmaan/LeadGenerationBundle/Controller/RulesAdminListController.php b/src/Kunstmaan/LeadGenerationBundle/Controller/RulesAdminListController.php index 45236ef379..546d805283 100644 --- a/src/Kunstmaan/LeadGenerationBundle/Controller/RulesAdminListController.php +++ b/src/Kunstmaan/LeadGenerationBundle/Controller/RulesAdminListController.php @@ -34,7 +34,9 @@ public function detailAction(Request $request, $popup) #[Route(path: '/{popup}/add', requirements: ['popup' => '\d+'], name: 'kunstmaanleadgenerationbundle_admin_rule_abstractrule_add', methods: ['GET', 'POST'])] public function addAction(Request $request, $popup): Response { - $type = $request->query->get('type'); + $type = $request->isMethod('post') + ? $request->request->get('type') + : $request->query->get('type'); return parent::doAddAction($this->getAdminListConfigurator($popup), $type, $request); }