| @@ 12-39 (lines=28) @@ | ||
| 9 | /** |
|
| 10 | * Class MenuSubscriber |
|
| 11 | */ |
|
| 12 | class MenuSubscriber implements EventSubscriberInterface |
|
| 13 | { |
|
| 14 | /** |
|
| 15 | * Returns an array of event names this subscriber wants to listen to. |
|
| 16 | * |
|
| 17 | * @return array The event names to listen to |
|
| 18 | */ |
|
| 19 | public static function getSubscribedEvents() |
|
| 20 | { |
|
| 21 | return [ |
|
| 22 | MenuEnum::MENU_MAIN => ['onConfigureMainMenu', 80], |
|
| 23 | ]; |
|
| 24 | } |
|
| 25 | ||
| 26 | /** |
|
| 27 | * @param MenuEvent $event |
|
| 28 | */ |
|
| 29 | public function onConfigureMainMenu(MenuEvent $event) |
|
| 30 | { |
|
| 31 | $event->getCurrentItem()->addChild( |
|
| 32 | 'field_notes', |
|
| 33 | [ |
|
| 34 | 'label' => 'Field-Notes', |
|
| 35 | 'route' => 'field_notes.index', |
|
| 36 | ] |
|
| 37 | ); |
|
| 38 | } |
|
| 39 | } |
|
| 40 | ||
| @@ 12-45 (lines=34) @@ | ||
| 9 | /** |
|
| 10 | * Class MenuSubscriber |
|
| 11 | */ |
|
| 12 | class MenuSubscriber implements EventSubscriberInterface |
|
| 13 | { |
|
| 14 | /** |
|
| 15 | * Returns an array of event names this subscriber wants to listen to. |
|
| 16 | * |
|
| 17 | * @return array The event names to listen to |
|
| 18 | */ |
|
| 19 | public static function getSubscribedEvents() |
|
| 20 | { |
|
| 21 | return [ |
|
| 22 | MenuEnum::MENU_MAIN => ['onConfigureMenu', 100], |
|
| 23 | ]; |
|
| 24 | } |
|
| 25 | ||
| 26 | /** |
|
| 27 | * @param MenuEvent $event |
|
| 28 | */ |
|
| 29 | public function onConfigureMenu(MenuEvent $event) |
|
| 30 | { |
|
| 31 | $event->getCurrentItem()->addChild( |
|
| 32 | 'Startseite', |
|
| 33 | [ |
|
| 34 | 'uri' => '/', |
|
| 35 | ] |
|
| 36 | ); |
|
| 37 | ||
| 38 | $event->getCurrentItem()->addChild( |
|
| 39 | 'Karte', |
|
| 40 | [ |
|
| 41 | 'uri' => '/map2.php', |
|
| 42 | ] |
|
| 43 | ); |
|
| 44 | } |
|
| 45 | } |
|
| 46 | ||