50 lines
1.1 KiB
PHP
50 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Menu;
|
|
|
|
use Knp\Menu\FactoryInterface;
|
|
use Knp\Menu\ItemInterface;
|
|
|
|
class MenuBuilder
|
|
{
|
|
public function __construct(
|
|
private readonly FactoryInterface $factory,
|
|
) {
|
|
}
|
|
|
|
public function createMainMenu(): ItemInterface
|
|
{
|
|
$menu = $this->factory->createItem('root', [
|
|
'childrenAttributes' => [
|
|
'class' => 'menu menu--main',
|
|
],
|
|
]);
|
|
|
|
$menu->addChild('Meine Daten', [
|
|
'route' => 'app_personal_data',
|
|
'linkAttributes' => [
|
|
'data-action' => 'loading#toggle',
|
|
],
|
|
]);
|
|
$menu->addChild('Meine Buchungen', [
|
|
'route' => 'app_bookings',
|
|
'linkAttributes' => [
|
|
'data-action' => 'loading#toggle',
|
|
],
|
|
'extras' => [
|
|
'routes' => [
|
|
'app_booking_edit',
|
|
],
|
|
],
|
|
]);
|
|
$menu->addChild('Logout', [
|
|
'route' => 'app_logout',
|
|
'linkAttributes' => [
|
|
'data-action' => 'loading#toggle',
|
|
],
|
|
]);
|
|
|
|
return $menu;
|
|
}
|
|
}
|