From f125d04af799df85cfd3ef2d9707076101d2d633 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Tue, 11 Mar 2025 16:49:24 +0100 Subject: [PATCH] fix(crud): use context variable to retrieve the form and the form options --- src/core/Controller/Admin/Crud/CrudController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/Controller/Admin/Crud/CrudController.php b/src/core/Controller/Admin/Crud/CrudController.php index 2cc123d..7d7092f 100644 --- a/src/core/Controller/Admin/Crud/CrudController.php +++ b/src/core/Controller/Admin/Crud/CrudController.php @@ -69,7 +69,7 @@ abstract class CrudController extends AdminController $this->prepareEntity($entity); - $form = $this->createForm($configuration->getForm('new'), $entity, $configuration->getFormOptions($context)); + $form = $this->createForm($configuration->getForm($context), $entity, $configuration->getFormOptions($context)); if ($request->isMethod('POST')) { $form->handleRequest($request); @@ -127,7 +127,7 @@ abstract class CrudController extends AdminController $this->prepareEntity($entity); - $form = $this->createForm($configuration->getForm('edit'), $entity, $configuration->getFormOptions($context)); + $form = $this->createForm($configuration->getForm($context), $entity, $configuration->getFormOptions($context)); if ($request->isMethod('POST')) { $form->handleRequest($request); @@ -412,13 +412,13 @@ abstract class CrudController extends AdminController protected function doFilter(Session $session, string $context = 'filter'): Response { $configuration = $this->getConfiguration(); - $type = $configuration->getForm('filter'); + $type = $configuration->getForm($context); if (null === $type) { throw $this->createNotFoundException(); } - $form = $this->createForm($type, null, $configuration->getFormOptions('filter')); + $form = $this->createForm($type, null, $configuration->getFormOptions($context)); $form->submit($session->get($form->getName(), [])); return $this->render($configuration->getView($context), [