function MenuTreeStorage::getAllChildIds
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Menu/MenuTreeStorage.php \Drupal\Core\Menu\MenuTreeStorage::getAllChildIds()
- 10 core/lib/Drupal/Core/Menu/MenuTreeStorage.php \Drupal\Core\Menu\MenuTreeStorage::getAllChildIds()
- 11.x core/lib/Drupal/Core/Menu/MenuTreeStorage.php \Drupal\Core\Menu\MenuTreeStorage::getAllChildIds()
Overrides MenuTreeStorageInterface::getAllChildIds
File
-
core/
lib/ Drupal/ Core/ Menu/ MenuTreeStorage.php, line 1068
Class
- MenuTreeStorage
- Provides a menu tree storage using the database.
Namespace
Drupal\Core\MenuCode
public function getAllChildIds($id) {
$root = $this->loadFull($id);
if (!$root) {
return [];
}
$query = $this->connection
->select($this->table, NULL, $this->options);
$query->fields($this->table, [
'id',
]);
$query->condition('menu_name', $root['menu_name']);
for ($i = 1; $i <= $root['depth']; $i++) {
$query->condition("p{$i}", $root["p{$i}"]);
}
// The next p column should not be empty. This excludes the root link.
$query->condition("p{$i}", 0, '>');
return $this->safeExecuteSelect($query)
->fetchAllKeyed(0, 0);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.