From c232e7ef629015d2a0d6e3451a49602cb175b56a Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Fri, 10 Jan 2025 15:17:46 +0100 Subject: [PATCH] 3547: Cleaned up --- src/Controller/Admin/AbstractCrudController.php | 9 +++++++++ src/Controller/Admin/ArchiverCrudController.php | 9 +++++---- src/Controller/Admin/ExceptionLogEntryCrudController.php | 6 +++--- .../Admin/GetOrganized/DocumentCrudController.php | 7 ++++--- 4 files changed, 21 insertions(+), 10 deletions(-) create mode 100644 src/Controller/Admin/AbstractCrudController.php diff --git a/src/Controller/Admin/AbstractCrudController.php b/src/Controller/Admin/AbstractCrudController.php new file mode 100644 index 0000000..c58af9d --- /dev/null +++ b/src/Controller/Admin/AbstractCrudController.php @@ -0,0 +1,9 @@ +showEntityActionsInlined(); + return parent::configureCrud($crud) + ->showEntityActionsInlined(); } public function configureActions(Actions $actions): Actions { - return $actions + return parent::configureActions($actions) ->disable(Action::DELETE); } @@ -50,7 +50,8 @@ public function configureFields(string $pageName): iterable ->setFormat($this->getParameter('display_datetime_format')) ->setTimezone($this->getParameter('display_datetime_timezone')) ->hideOnForm(); - yield BooleanField::new('enabled'); + yield BooleanField::new('enabled') + ->renderAsSwitch(false); yield CodeEditorField::new('configuration') ->hideOnIndex() ->setLanguage('yaml') diff --git a/src/Controller/Admin/ExceptionLogEntryCrudController.php b/src/Controller/Admin/ExceptionLogEntryCrudController.php index 1ebe2c9..bd412c4 100644 --- a/src/Controller/Admin/ExceptionLogEntryCrudController.php +++ b/src/Controller/Admin/ExceptionLogEntryCrudController.php @@ -7,7 +7,6 @@ use EasyCorp\Bundle\EasyAdminBundle\Config\Action; use EasyCorp\Bundle\EasyAdminBundle\Config\Actions; use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; -use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Field\CodeEditorField; use EasyCorp\Bundle\EasyAdminBundle\Field\DateField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField; @@ -21,14 +20,15 @@ public static function getEntityFqcn(): string public function configureCrud(Crud $crud): Crud { - return $crud->showEntityActionsInlined() + return parent::configureCrud($crud) + ->showEntityActionsInlined() ->setDefaultSort(['createdAt' => Criteria::DESC]) ; } public function configureActions(Actions $actions): Actions { - return $actions + return parent::configureActions($actions) ->disable(Action::NEW, Action::EDIT, Action::DELETE) ->add(Crud::PAGE_INDEX, Action::DETAIL); } diff --git a/src/Controller/Admin/GetOrganized/DocumentCrudController.php b/src/Controller/Admin/GetOrganized/DocumentCrudController.php index 7ac3632..4b31d27 100644 --- a/src/Controller/Admin/GetOrganized/DocumentCrudController.php +++ b/src/Controller/Admin/GetOrganized/DocumentCrudController.php @@ -3,12 +3,12 @@ namespace App\Controller\Admin\GetOrganized; use App\Admin\Field\JsonField; +use App\Controller\Admin\AbstractCrudController; use App\Entity\GetOrganized\Document; use Doctrine\Common\Collections\Criteria; use EasyCorp\Bundle\EasyAdminBundle\Config\Action; use EasyCorp\Bundle\EasyAdminBundle\Config\Actions; use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; -use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; use EasyCorp\Bundle\EasyAdminBundle\Field\DateField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; @@ -22,14 +22,15 @@ public static function getEntityFqcn(): string public function configureCrud(Crud $crud): Crud { - return $crud->showEntityActionsInlined() + return parent::configureCrud($crud) + ->showEntityActionsInlined() ->setDefaultSort(['updatedAt' => Criteria::DESC]) ; } public function configureActions(Actions $actions): Actions { - return $actions + return parent::configureActions($actions) ->disable(Action::NEW, Action::EDIT, Action::DELETE) ->add(Crud::PAGE_INDEX, Action::DETAIL); }