Skip to content

Make removing the "Sign out" button easier #5812

@simoheinonen

Description

@simoheinonen

Short description of what this feature will allow to do:

Make removing the "Sign out" button easier because many authentication methods don't really support logging out (basic, oauth)

Right now you can do something like this:

    public function configureUserMenu(UserInterface $user): UserMenu
    {
        $userMenu = parent::configureUserMenu($user);

        $items = $userMenu->getAsDto()->getItems();

        foreach ($items as $index => $item) {
            if ($item instanceof LogoutMenuItem) {
                unset($items[$index]);
            }
        }

        $userMenu->setMenuItems($items);

        return $userMenu;
    }

Example of how to use this feature

$userMenu->displayLogout(false);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions