fix(crud): use context variable to retrieve the form and the form options
This commit is contained in:
parent
aac4e21a65
commit
f125d04af7
1 changed files with 4 additions and 4 deletions
|
|
@ -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), [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue