interface MenuActiveTrailInterface

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Menu/MenuActiveTrailInterface.php \Drupal\Core\Menu\MenuActiveTrailInterface
  2. 10 core/lib/Drupal/Core/Menu/MenuActiveTrailInterface.php \Drupal\Core\Menu\MenuActiveTrailInterface
  3. 11.x core/lib/Drupal/Core/Menu/MenuActiveTrailInterface.php \Drupal\Core\Menu\MenuActiveTrailInterface

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.

Hierarchy

Expanded class hierarchy of MenuActiveTrailInterface

All classes that implement MenuActiveTrailInterface

2 files declare their use of MenuActiveTrailInterface
SystemManager.php in core/modules/system/src/SystemManager.php
SystemMenuBlock.php in core/modules/system/src/Plugin/Block/SystemMenuBlock.php

File

core/lib/Drupal/Core/Menu/MenuActiveTrailInterface.php, line 11

Namespace

Drupal\Core\Menu
View source
interface MenuActiveTrailInterface {
    
    /**
     * Gets the active trail IDs of the specified menu tree.
     *
     * @param string|null $menu_name
     *   (optional) The menu name of the requested tree. If omitted, all menu
     *   trees will be searched.
     *
     * @return array
     *   An array containing the active trail: a list of plugin IDs.
     */
    public function getActiveTrailIds($menu_name);
    
    /**
     * Fetches a menu link which matches the route name, parameters and menu name.
     *
     * @param string|null $menu_name
     *   (optional) The menu within which to find the active link. If omitted, all
     *   menus will be searched.
     *
     * @return \Drupal\Core\Menu\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).
     */
    public function getActiveLink($menu_name = NULL);

}

Members

Title Sort descending Modifiers Object type Summary Overrides
MenuActiveTrailInterface::getActiveLink public function Fetches a menu link which matches the route name, parameters and menu name. 1
MenuActiveTrailInterface::getActiveTrailIds public function Gets the active trail IDs of the specified menu tree. 1

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.