resolveArea(); $menu = match ($area) { 'ROLE_TEAM_ADMIN' => $this->adminMenuBuilder->createMainMenu($options), 'ROLE_MANAGER' => $this->managerMenuBuilder->createMainMenu($options), 'ROLE_HOUSE_MANAGER' => $this->houseManagerMenuBuilder->createMainMenu($options), 'ROLE_TEAMER' => $this->teamerMenuBuilder->createMainMenu($options), default => $this->createRootElement(), }; $user = $this->security->getUser(); if ($user instanceof User) { $this->addDivider($menu); // A group without uri, so the sidebar renders it collapsible; the teamer menu has its own "Mein Profil". $account = $menu->addChild('account', [ 'label' => 'Mein Account', 'extras' => [ 'icon' => 'user', ], ]); $this->addAccountItems($account, withIcons: false, withProfile: 'ROLE_TEAMER' !== $area); } return $menu; } /** * The account menu behind the user's picture in the header: own profile, the other areas and logout. */ public function createUserMenu(array $options): ItemInterface { $menu = $this->createRootElement(); $this->addAccountItems($menu); return $menu; } public function createTeamerMenu(array $options): ItemInterface { return match ($this->resolveArea()) { 'ROLE_TEAM_ADMIN' => $this->adminMenuBuilder->createTeamerMenu($options), 'ROLE_MANAGER' => $this->managerMenuBuilder->createTeamerMenu($options), default => $this->createRootElement(), }; } }