|
- <?php
-
- namespace Lc\AdminBundle\Controller\Admin;
-
- use App\Entity\Page;
- 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\AdminBundle\IModel\Translation\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('@LcAdmin/crud/action/translatable.html.twig');
- });
- }
-
- return $actions;
- }
-
- public function configureCrud(Crud $crud): Crud
- {
- return $crud
- ->overrideTemplates([
- 'crud/edit' => '@LcAdmin/crud/edit.html.twig',
- 'crud/new' => '@LcAdmin/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(['@LcAdmin/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/lcadmin/js/utils.js');
- }
-
- /*
- public function configureFields(string $pageName): iterable
- {
- return [
- IdField::new('id'),
- TextField::new('title'),
- TextEditorField::new('description'),
- ];
- }
- */
- }
|