You are here

public function MenuTreeStorage::getSubtreeHeight in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Menu/MenuTreeStorage.php \Drupal\Core\Menu\MenuTreeStorage::getSubtreeHeight()

Finds the height of a subtree rooted by the given ID.

Parameters

string $id: The ID of an item in the storage.

Return value

int Returns the height of the subtree. This will be at least 1 if the ID exists, or 0 if the ID does not exist in the storage.

Overrides MenuTreeStorageInterface::getSubtreeHeight

File

core/lib/Drupal/Core/Menu/MenuTreeStorage.php, line 439

Class

MenuTreeStorage
Provides a menu tree storage using the database.

Namespace

Drupal\Core\Menu

Code

public function getSubtreeHeight($id) {
  $original = $this
    ->loadFull($id);
  return $original ? $this
    ->doFindChildrenRelativeDepth($original) + 1 : 0;
}