|
- <?php
-
- namespace Lc\SovBundle\Controller\Dashboard;
-
- 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 DashboardAdminController 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/'.$this->get('parameter_bag')->get('app.admin.logo').'" width="100px">')
- // the path defined in this method is passed to the Twig asset() function
- ->setFaviconPath('assets/img/frontend/favicon-pdl.png')
- // the domain used by default is 'messages'
- ->setTranslationDomain('admin');
- }
-
- public function configureAssets(): Assets
- {
- $assets = parent::configureAssets();
-
- $assets->addWebpackEncoreEntry('adminlte-plugins');
- $assets->addWebpackEncoreEntry('adminlte-index');
- $assets->addWebpackEncoreEntry('adminlte-form');
- $assets->addWebpackEncoreEntry('adminlte-sort');
- $assets->addWebpackEncoreEntry('adminlte-field-collection');
- $assets->addWebpackEncoreEntry('adminlte-field-filemanager');
- $assets->addWebpackEncoreEntry('adminlte-main');
- $assets->addWebpackEncoreEntry('sov-reminder');
-
- 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->getFirstName())
- // 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::linkToLogout('Déconnexion', 'sign-out-alt'),
- //MenuItem::linkToLogout('Déconnexion', 'sign-out-alt')
- ]
- );
- }
-
- 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/form.html.twig',
- 'crud/new' => '@LcSov/adminlte/crud/form.html.twig',
- 'flash_messages' => '@LcSov/adminlte/block/flash_messages.html.twig',
- ]
- )
- ->setFormThemes(
- [
- '@LcSov/adminlte/crud/form_theme.html.twig',
- //'@FOSCKEditor/Form/ckeditor_widget.html.twig'
- ]
- );
- }
- }
|