|
- <?php
-
- namespace Lc\SovBundle\Controller\Admin;
-
- use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
- use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
- use EasyCorp\Bundle\EasyAdminBundle\Config\Assets;
- use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
- use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController as EaAbstractCrudController;
- use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
- use Lc\SovBundle\Doctrine\Extension\TranslatableInterface;
-
- abstract class AbstractCrudController extends EaAbstractCrudController
- {
-
- public function configureActions(Actions $actions): Actions
- {
- if (in_array(TranslatableInterface::class, class_implements($this->getEntityFqcn()))) {
- $actions->update(
- Crud::PAGE_INDEX,
- Action::EDIT,
- function (Action $action) {
- return $action->setTemplatePath('@LcSov/crud/action/translatable.html.twig');
- }
- );
- }
-
- return $actions;
- }
-
- public function configureCrud(Crud $crud): Crud
- {
- return $crud
- ->overrideTemplates(
- [
- 'crud/edit' => '@LcSov/crud/edit.html.twig',
- 'crud/new' => '@LcSov/crud/new.html.twig',
- ]
- )
- // don't forget to add EasyAdmin's form theme at the end of the list
- // (otherwise you'll lose all the styles for the rest of form fields)
- ->setFormThemes(['@LcSov/crud/form_theme.html.twig', '@FOSCKEditor/Form/ckeditor_widget.html.twig']);
- }
-
-
- public function configureAssets(Assets $assets): Assets
- {
- return $assets
- // adds the CSS and JS assets associated to the given Webpack Encore entry
- // it's equivalent to calling encore_entry_link_tags('...') and encore_entry_script_tags('...')
- //->addWebpackEncoreEntry('admin-app')
-
- // the argument of these methods is passed to the asset() Twig function
- // CSS assets are added just before the closing </head> element
- // and JS assets are added just before the closing </body> element
- ->addJsFile('bundles/lc_sov/js/utils.js');
- }
-
- /*
- public function configureFields(string $pageName): iterable
- {
- return [
- IdField::new('id'),
- TextField::new('title'),
- TextEditorField::new('description'),
- ];
- }
- */
- }
|