|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?php
-
- namespace Lc\SovBundle\Controller\Admin;
-
- use EasyCorp\Bundle\EasyAdminBundle\Config\Assets;
- use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
- use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
- use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
- use EasyCorp\Bundle\EasyAdminBundle\Config\UserMenu;
- use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
- use Lc\SovBundle\Doctrine\EntityManager;
- use Symfony\Component\Security\Core\User\UserInterface;
- use Symfony\Component\HttpFoundation\Response;
- use Symfony\Component\Routing\Annotation\Route;
-
- class DashboardController extends AbstractDashboardController
- {
- public function index(): Response
- {
- return $this->render('@LcSov/adminlte/dashboard.html.twig');
- }
-
- public function configureDashboard(): Dashboard
- {
- return Dashboard::new()
- // the name visible to end users
- ->setTitle('LA CLIC !')
- // you can include HTML contents too (e.g. to link to an image)
- ->setTitle('<img src="assets/img/laclic.png" width="100px">')
- // the path defined in this method is passed to the Twig asset() function
- ->setFaviconPath('favicon.svg')
- // the domain used by default is 'messages'
- ->setTranslationDomain('lcadmin');
- }
-
- public function configureAssets(): Assets
- {
- $assets = parent::configureAssets();
- $assets->addWebpackEncoreEntry('adminlte-common');
-
- return $assets;
- }
-
- public function configureUserMenu(UserInterface $user): UserMenu
- {
- // Usually it's better to call the parent method because that gives you a
- // user menu with some menu items already created ("sign out", "exit impersonation", etc.)
- // if you prefer to create the user menu from scratch, use: return UserMenu::new()->...
- return parent::configureUserMenu($user)
- // use the given $user object to get the user name
- ->setName($user->getName())
- // use this method if you don't want to display the name of the user
- //->displayUserName(false)
- ->displayUserAvatar(false)
- // you can also pass an email address to use gravatar's service
- ->setGravatarEmail($user->getEmail())
-
- // you can use any type of menu item, except submenus
- ->setMenuItems(
- [
- //MenuItem::linkToRoute('My Profile', 'fa fa-id-card', '', ['...' => '...']),
- //MenuItem::section(),
- MenuItem::linkToLogout('Déconnexion', 'fa fa-sign-out'),
- ]
- );
- }
-
- public function configureCrud(): Crud
- {
- $crud = Crud::new();
-
- return $crud
- ->overrideTemplates(
- [
- 'layout' => '@LcSov/adminlte/layout.html.twig',
- 'main_menu' => '@LcSov/adminlte/block/menu.html.twig',
- 'crud/index' => '@LcSov/adminlte/crud/index.html.twig',
- 'crud/paginator' => '@LcSov/adminlte/crud/paginator.html.twig',
- 'crud/edit' => '@LcSov/adminlte/crud/edit.html.twig',
- 'crud/new' => '@LcSov/adminlte/crud/new.html.twig',
- ]
- )
- ->setFormThemes(
- [
- '@LcSov/adminlte/crud/form_theme.html.twig',
- '@FOSCKEditor/Form/ckeditor_widget.html.twig'
- ]
- );
- }
-
- }
|