interface MenuActiveTrailInterface (View source)

Defines an interface for the active menu trail service.

The active trail of a given menu is the trail from the current page to the root of that menu's tree.

Methods

array
getActiveTrailIds(string|null $menu_name)

Gets the active trail IDs of the specified menu tree.

getActiveLink(string|null $menu_name = NULL)

Fetches a menu link which matches the route name, parameters and menu name.

Details

array getActiveTrailIds(string|null $menu_name)

Gets the active trail IDs of the specified menu tree.

Parameters

string|null $menu_name

(optional) The menu name of the requested tree. If omitted, all menu trees will be searched.

Return Value

array

An array containing the active trail: a list of plugin IDs.

Fetches a menu link which matches the route name, parameters and menu name.

Parameters

string|null $menu_name

(optional) The menu within which to find the active link. If omitted, all menus will be searched.

Return Value

MenuLinkInterface|null

The menu link for the given route name, parameters and menu, or NULL if there is no matching menu link or the current user cannot access the current page (i.e. we have a 403 response).