Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

94 lines
3.8KB

  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('lcadmin');
  30. }
  31. public function configureAssets(): Assets
  32. {
  33. $assets = parent::configureAssets();
  34. $assets->addWebpackEncoreEntry('adminlte-common');
  35. $assets->addWebpackEncoreEntry('adminlte-index');
  36. return $assets;
  37. }
  38. public function configureUserMenu(UserInterface $user): UserMenu
  39. {
  40. // Usually it's better to call the parent method because that gives you a
  41. // user menu with some menu items already created ("sign out", "exit impersonation", etc.)
  42. // if you prefer to create the user menu from scratch, use: return UserMenu::new()->...
  43. return parent::configureUserMenu($user)
  44. // use the given $user object to get the user name
  45. ->setName($user->getName())
  46. // use this method if you don't want to display the name of the user
  47. //->displayUserName(false)
  48. ->displayUserAvatar(false)
  49. // you can also pass an email address to use gravatar's service
  50. ->setGravatarEmail($user->getEmail())
  51. // you can use any type of menu item, except submenus
  52. ->setMenuItems(
  53. [
  54. //MenuItem::linkToRoute('My Profile', 'fa fa-id-card', '', ['...' => '...']),
  55. //MenuItem::section(),
  56. MenuItem::linkToLogout('Déconnexion', 'fa fa-sign-out'),
  57. ]
  58. );
  59. }
  60. public function configureCrud(): Crud
  61. {
  62. $crud = Crud::new();
  63. return $crud
  64. ->overrideTemplates(
  65. [
  66. 'layout' => '@LcSov/adminlte/layout.html.twig',
  67. 'main_menu' => '@LcSov/adminlte/block/menu.html.twig',
  68. 'crud/index' => '@LcSov/adminlte/crud/index.html.twig',
  69. 'crud/paginator' => '@LcSov/adminlte/crud/paginator.html.twig',
  70. 'crud/edit' => '@LcSov/adminlte/crud/edit.html.twig',
  71. 'crud/new' => '@LcSov/adminlte/crud/new.html.twig',
  72. ]
  73. )
  74. ->setFormThemes(
  75. [
  76. '@LcSov/adminlte/crud/form_theme.html.twig',
  77. '@FOSCKEditor/Form/ckeditor_widget.html.twig'
  78. ]
  79. );
  80. }
  81. }