summaryrefslogtreecommitdiffstatshomepage
path: root/core/lib/Drupal/Core/Menu/MenuActiveTrailInterface.php
blob: 9322c3628c610be24c3f75fdb2cb0f69dadc5b33 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php

namespace Drupal\Core\Menu;

/**
 * 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.
 */
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 that matches the currently active route.
   *
   * @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 currently active route, 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);

}