MenuLinkManager::getParentIds

public MenuLinkManager::getParentIds($id)

Loads all parent link IDs of a given menu link.

This method is very similar to getActiveTrailIds() but allows the link to be specified rather than being discovered based on the menu name and request. This method is mostly useful for testing.

Parameters

string $id: The menu link plugin ID.

Return value

array An ordered array of IDs representing the path to the root of the tree. The first element of the array will be equal to $id, unless $id is not valid, in which case the return value will be NULL.

Overrides MenuLinkManagerInterface::getParentIds

File

core/lib/Drupal/Core/Menu/MenuLinkManager.php, line 316

Class

MenuLinkManager
Manages discovery, instantiation, and tree building of menu link plugins.

Namespace

Drupal\Core\Menu

Code

public function getParentIds($id) {
  if ($this->getDefinition($id, FALSE)) {
    return $this->treeStorage->getRootPathIds($id);
  }
  return NULL;
}
doc_Drupal
2016-10-29 09:27:06
Comments
Leave a Comment

Please login to continue.