diff --git a/application/src/Subscriber/UserMenuSubscriber.php b/application/src/Subscriber/UserMenuSubscriber.php index 7c9fa03..4286c98 100644 --- a/application/src/Subscriber/UserMenuSubscriber.php +++ b/application/src/Subscriber/UserMenuSubscriber.php @@ -1,24 +1,27 @@ tokenStorage = $tokenStorage; @@ -31,64 +34,64 @@ class UserMenuSubscriber implements EventSubscriberInterface $menu->addChild('start', [ 'route' => 'homepage', 'attributes' => [ - 'icon' => 'fab fa-font-awesome-flag', - ], - ] - ); - - $menu->addChild( - 'imprint', - [ - 'route' => 'imprint', - 'attributes' => [ - 'icon' => 'fas fa-address-card', - ], + 'icon' => 'fab fa-font-awesome-flag' ] - ); + ]); + + $menu->addChild('imprint', [ + 'route' => 'imprint', + 'attributes' => [ + 'icon' => 'fas fa-address-card' + ] + ]); + $this->generateUserDropdown($menu); + } + private function generateUserDropdown(ItemInterface $menu): void + { $dropdown = $menu->addChild($this->tokenStorage->getToken() ->getUsername() ?? 'user', [ 'attributes' => [ 'dropdown' => true, - 'icon' => 'fas fa-user', - ], + 'icon' => 'fas fa-user' + ] ]); if ($this->tokenStorage->getToken()->getRoles()) { $dropdown->addChild('logout', [ 'route' => 'logout', 'attributes' => [ 'icon' => 'fas fa-sign-out-alt', - 'divider_append' => true, - ], + 'divider_append' => true + ] ]); $dropdown->addChild('edit profile', [ 'route' => 'fos_user_profile_edit', 'attributes' => [ 'icon' => 'fas fa-user-edit', - 'divider_append' => true, - ], + 'divider_append' => true + ] ]); } else { $dropdown->addChild('login', [ 'route' => 'fos_user_security_login', 'attributes' => [ 'divider_append' => true, - 'icon' => 'fas fa-sign-in-alt', - ], + 'icon' => 'fas fa-sign-in-alt' + ] ]); } $dropdown->addChild('register', [ 'route' => 'fos_user_registration_register', 'attributes' => [ - 'icon' => 'fas fa-file-signature', - ], + 'icon' => 'fas fa-file-signature' + ] ]); } public static function getSubscribedEvents(): array { return [ - UserMenuEvent::EVENT => 'onUserMenuConfigure', + UserMenuEvent::EVENT => 'onUserMenuConfigure' ]; } } diff --git a/application/templates/frames/default.html.twig b/application/templates/frames/default.html.twig index 8833265..4ba0191 100644 --- a/application/templates/frames/default.html.twig +++ b/application/templates/frames/default.html.twig @@ -1,6 +1,6 @@ {% extends "base.html.twig" %} {% block body %} -{% include 'frames/structure/navbar.html.twig'%} +{% include 'frames/structure/navbar/navbar_top.html.twig'%}
{% include 'frames/structure/message/flash_messages.html.twig'%} diff --git a/application/templates/frames/structure/knp_menu.html.twig b/application/templates/frames/structure/navbar/knp_menu.html.twig similarity index 100% rename from application/templates/frames/structure/knp_menu.html.twig rename to application/templates/frames/structure/navbar/knp_menu.html.twig diff --git a/application/templates/frames/structure/navbar.html.twig b/application/templates/frames/structure/navbar/navbar_top.html.twig similarity index 90% rename from application/templates/frames/structure/navbar.html.twig rename to application/templates/frames/structure/navbar/navbar_top.html.twig index 33aebe8..3920bc1 100644 --- a/application/templates/frames/structure/navbar.html.twig +++ b/application/templates/frames/structure/navbar/navbar_top.html.twig @@ -7,6 +7,6 @@