public function MenuTreeStorage::getSubtreeHeight in Colossal Menu 8
Same name and namespace in other branches
- 2.x src/Menu/MenuTreeStorage.php \Drupal\colossal_menu\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
- src/
Menu/ MenuTreeStorage.php, line 338
Class
- MenuTreeStorage
- Provides a menu tree storage using the database.
Namespace
Drupal\colossal_menu\MenuCode
public function getSubtreeHeight($id) {
return $this->conneciton
->select($this->table, 't')
->fields('t', [
'depth',
])
->condition('t.descendant', $id)
->orderBy('t.depth', 'DESC')
->limit(0, 1)
->execute()
->fetchField();
}