diff --git a/application/src/Subscriber/UserMenuSubscriber.php b/application/src/Subscriber/UserMenuSubscriber.php index c3d6621..8e901b4 100644 --- a/application/src/Subscriber/UserMenuSubscriber.php +++ b/application/src/Subscriber/UserMenuSubscriber.php @@ -1,5 +1,6 @@ getItem(); - $menu->addChild( - 'start', - [ - 'route' => 'homepage', - 'attributes' => [ - 'icon' => 'fab fa-font-awesome-flag', - ], + $menu->addChild('start', [ + 'route' => 'homepage', + 'attributes' => [ + 'icon' => 'fab fa-font-awesome-flag' ] - ); - - $menu->addChild( - 'imprint', - [ - 'route'=>'imprint', - 'attributes' => [ - 'icon' => 'fas fa-address-card', - ], + ]); + + $menu->addChild('imprint', [ + 'route' => 'imprint', + 'attributes' => [ + 'icon' => 'fas fa-address-card' ] - ); - - $dropdown = $menu->addChild( - 'user', - [ - 'attributes' => [ - 'dropdown' => true, - 'icon' => 'fas fa-user', - ], + ]); + + $dropdown = $menu->addChild('user', [ + 'attributes' => [ + 'dropdown' => true, + 'icon' => 'fas fa-user' ] - ); - - $dropdown->addChild( - 'login', - [ - 'route' => 'login', - 'attributes' => [ - 'divider_append' => true, - 'icon' => 'fas fa-sign-in-alt', - ], - ] - ); - - $dropdown->addChild( - 'logout', - [ + ]); + /** + * @todo replace the following check trough fos bundle + */ + if ($this->tokenStorage->getToken()->getRoles()) { + $dropdown->addChild('logout', [ 'route' => 'logout', 'attributes' => [ 'icon' => 'fas fa-sign-out-alt', - ], - ] - ); - - $dropdown->addChild( - 'register', - [ - 'route' => 'user_register', + 'divider_append' => true, + ] + ]); + } else { + $dropdown->addChild('login', [ + 'route' => 'login', 'attributes' => [ - 'divider_prepend' => true, - 'icon' => 'fas fa-file-signature', - ], + 'divider_append' => true, + 'icon' => 'fas fa-sign-in-alt' + ] + ]); + } + $dropdown->addChild('register', [ + 'route' => 'user_register', + 'attributes' => [ + 'icon' => 'fas fa-file-signature' ] - ); + ]); } public static function getSubscribedEvents(): array