MenuActiveTrailInterface.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace Drupal\Core\Menu;
  3. /**
  4. * Defines an interface for the active menu trail service.
  5. *
  6. * The active trail of a given menu is the trail from the current page to the
  7. * root of that menu's tree.
  8. */
  9. interface MenuActiveTrailInterface {
  10. /**
  11. * Gets the active trail IDs of the specified menu tree.
  12. *
  13. * @param string|null $menu_name
  14. * (optional) The menu name of the requested tree. If omitted, all menu
  15. * trees will be searched.
  16. *
  17. * @return array
  18. * An array containing the active trail: a list of plugin IDs.
  19. */
  20. public function getActiveTrailIds($menu_name);
  21. /**
  22. * Fetches a menu link which matches the route name, parameters and menu name.
  23. *
  24. * @param string|null $menu_name
  25. * (optional) The menu within which to find the active link. If omitted, all
  26. * menus will be searched.
  27. *
  28. * @return \Drupal\Core\Menu\MenuLinkInterface|null
  29. * The menu link for the given route name, parameters and menu, or NULL if
  30. * there is no matching menu link or the current user cannot access the
  31. * current page (i.e. we have a 403 response).
  32. */
  33. public function getActiveLink($menu_name = NULL);
  34. }