Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

AbstractCrudController.php 2.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace Lc\AdminBundle\Controller\Admin;
  3. use App\Entity\Page;
  4. use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
  5. use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
  6. use EasyCorp\Bundle\EasyAdminBundle\Config\Assets;
  7. use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
  8. use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController as EaAbstractCrudController;
  9. use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
  10. use Lc\AdminBundle\IModel\Translation\TranslatableInterface;
  11. abstract class AbstractCrudController extends EaAbstractCrudController
  12. {
  13. public function configureActions(Actions $actions): Actions
  14. {
  15. if (in_array(TranslatableInterface::class, class_implements($this->getEntityFqcn()))) {
  16. $actions->update(Crud::PAGE_INDEX, Action::EDIT, function (Action $action) {
  17. return $action->setTemplatePath('@LcAdmin/crud/action/translatable.html.twig');
  18. });
  19. }
  20. return $actions;
  21. }
  22. public function configureCrud(Crud $crud): Crud
  23. {
  24. return $crud
  25. ->overrideTemplates([
  26. 'crud/edit' => '@LcAdmin/crud/edit.html.twig',
  27. 'crud/new' => '@LcAdmin/crud/new.html.twig'
  28. ])
  29. // don't forget to add EasyAdmin's form theme at the end of the list
  30. // (otherwise you'll lose all the styles for the rest of form fields)
  31. ->setFormThemes(['@LcAdmin/crud/form_theme.html.twig', '@FOSCKEditor/Form/ckeditor_widget.html.twig']);
  32. }
  33. public function configureAssets(Assets $assets): Assets
  34. {
  35. return $assets
  36. // adds the CSS and JS assets associated to the given Webpack Encore entry
  37. // it's equivalent to calling encore_entry_link_tags('...') and encore_entry_script_tags('...')
  38. //->addWebpackEncoreEntry('admin-app')
  39. // the argument of these methods is passed to the asset() Twig function
  40. // CSS assets are added just before the closing </head> element
  41. // and JS assets are added just before the closing </body> element
  42. ->addJsFile('bundles/lcadmin/js/utils.js');
  43. }
  44. /*
  45. public function configureFields(string $pageName): iterable
  46. {
  47. return [
  48. IdField::new('id'),
  49. TextField::new('title'),
  50. TextEditorField::new('description'),
  51. ];
  52. }
  53. */
  54. }