Optimized menu

This commit is contained in:
Kevin Frantz 2018-09-13 02:47:57 +02:00
parent 8f119338f0
commit 255d580532

View File

@ -44,21 +44,27 @@ class UserMenuSubscriber implements EventSubscriberInterface
] ]
]); ]);
$dropdown = $menu->addChild('user', [ $dropdown = $menu->addChild($this->tokenStorage->getToken()
->getUsername() ?? 'user', [
'attributes' => [ 'attributes' => [
'dropdown' => true, 'dropdown' => true,
'icon' => 'fas fa-user' 'icon' => 'fas fa-user'
] ]
]); ]);
/**
* @todo replace the following check trough fos bundle
*/
if ($this->tokenStorage->getToken()->getRoles()) { if ($this->tokenStorage->getToken()->getRoles()) {
$dropdown->addChild('logout', [ $dropdown->addChild('logout', [
'route' => 'logout', 'route' => 'logout',
'attributes' => [ 'attributes' => [
'icon' => 'fas fa-sign-out-alt', '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
] ]
]); ]);
} else { } else {