Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

DashboardController.php 3.9KB

před 3 roky
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. namespace Lc\SovBundle\Controller\Admin;
  3. use EasyCorp\Bundle\EasyAdminBundle\Config\Assets;
  4. use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
  5. use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
  6. use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
  7. use EasyCorp\Bundle\EasyAdminBundle\Config\UserMenu;
  8. use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
  9. use Lc\SovBundle\Doctrine\EntityManager;
  10. use Symfony\Component\Security\Core\User\UserInterface;
  11. use Symfony\Component\HttpFoundation\Response;
  12. use Symfony\Component\Routing\Annotation\Route;
  13. class DashboardController extends AbstractDashboardController
  14. {
  15. public function index(): Response
  16. {
  17. return $this->render('@LcSov/adminlte/dashboard.html.twig');
  18. }
  19. public function configureDashboard(): Dashboard
  20. {
  21. return Dashboard::new()
  22. // the name visible to end users
  23. ->setTitle('LA CLIC !')
  24. // you can include HTML contents too (e.g. to link to an image)
  25. ->setTitle('<img src="assets/img/laclic.png" width="100px">')
  26. // the path defined in this method is passed to the Twig asset() function
  27. ->setFaviconPath('favicon.svg')
  28. // the domain used by default is 'messages'
  29. ->setTranslationDomain('admin');
  30. }
  31. public function configureAssets(): Assets
  32. {
  33. $assets = parent::configureAssets();
  34. $assets->addWebpackEncoreEntry('adminlte-common');
  35. $assets->addWebpackEncoreEntry('adminlte-index');
  36. $assets->addWebpackEncoreEntry('adminlte-form');
  37. $assets->addWebpackEncoreEntry('adminlte-sort');
  38. $assets->addWebpackEncoreEntry('adminlte-field-collection');
  39. $assets->addWebpackEncoreEntry('adminlte-field-filemanager');
  40. return $assets;
  41. }
  42. public function configureUserMenu(UserInterface $user): UserMenu
  43. {
  44. // Usually it's better to call the parent method because that gives you a
  45. // user menu with some menu items already created ("sign out", "exit impersonation", etc.)
  46. // if you prefer to create the user menu from scratch, use: return UserMenu::new()->...
  47. return parent::configureUserMenu($user)
  48. // use the given $user object to get the user name
  49. ->setName($user->getName())
  50. // use this method if you don't want to display the name of the user
  51. //->displayUserName(false)
  52. ->displayUserAvatar(false)
  53. // you can also pass an email address to use gravatar's service
  54. ->setGravatarEmail($user->getEmail())
  55. // you can use any type of menu item, except submenus
  56. ->setMenuItems(
  57. [
  58. //MenuItem::linkToRoute('My Profile', 'fa fa-id-card', '', ['...' => '...']),
  59. MenuItem::linkToLogout('Déconnexion', 'sign-out-alt'),
  60. //MenuItem::linkToLogout('Déconnexion', 'sign-out-alt')
  61. ]
  62. );
  63. }
  64. public function configureCrud(): Crud
  65. {
  66. $crud = Crud::new();
  67. return $crud
  68. ->overrideTemplates(
  69. [
  70. 'layout' => '@LcSov/adminlte/layout.html.twig',
  71. 'main_menu' => '@LcSov/adminlte/block/menu.html.twig',
  72. 'crud/index' => '@LcSov/adminlte/crud/index.html.twig',
  73. 'crud/paginator' => '@LcSov/adminlte/crud/paginator.html.twig',
  74. 'crud/edit' => '@LcSov/adminlte/crud/edit.html.twig',
  75. 'crud/new' => '@LcSov/adminlte/crud/new.html.twig',
  76. 'flash_messages' => '@LcSov/adminlte/block/flash_messages.html.twig',
  77. ]
  78. )
  79. ->setFormThemes(
  80. [
  81. '@LcSov/adminlte/crud/form_theme.html.twig',
  82. '@FOSCKEditor/Form/ckeditor_widget.html.twig'
  83. ]
  84. );
  85. }
  86. }