39 lines
1.0 KiB
PHP
39 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Controller;
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
use Symfony\Component\Routing\Attribute\Route;
|
|
|
|
final class BaseAdminController extends AbstractController
|
|
{
|
|
#[Route('/admin', name: 'admin_dashboard')]
|
|
public function admin(): Response
|
|
{
|
|
return $this->render('base-admin/index.html.twig', []);
|
|
}
|
|
|
|
#[Route('/sidebar', name: 'admin_sidebar')]
|
|
public function sidebar(string $path): Response
|
|
{
|
|
return $this->render('base-admin/sidebar.html.twig', [
|
|
'path' => $path,
|
|
'title' => $this->mapPathToFrenchTitle($path)
|
|
]);
|
|
}
|
|
|
|
private function mapPathToFrenchTitle(string $path): string
|
|
{
|
|
$mapping = [
|
|
'/admin' => 'Tableau de bord',
|
|
'/admin/module' => 'Module',
|
|
'/admin/news' => 'Actualité',
|
|
'/admin/image' => 'Image',
|
|
'/admin/news/add' => 'Ajouter une actualité',
|
|
];
|
|
|
|
return $mapping[$path] ?? 'Inconnu';
|
|
}
|
|
}
|