function MenuActiveTrail::getActiveLink

Fetches a menu link that matches the currently active route.

Parameters

string|null $menu_name: (optional) The menu within which to find the active link. If omitted, all menus will be searched.

Return value

\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).

Overrides MenuActiveTrailInterface::getActiveLink

File

core/lib/Drupal/Core/ProxyClass/Menu/MenuActiveTrail.php, line 81

Class

MenuActiveTrail
Provides a proxy class for \Drupal\Core\Menu\MenuActiveTrail.

Namespace

Drupal\Core\ProxyClass\Menu

Code

public function getActiveLink($menu_name = NULL) {
  return $this->lazyLoadItself()
    ->getActiveLink($menu_name);
}

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