public function MenuTreeStorage::getRootPathIds in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Menu/MenuTreeStorage.php \Drupal\Core\Menu\MenuTreeStorage::getRootPathIds()
- 9 core/lib/Drupal/Core/Menu/MenuTreeStorage.php \Drupal\Core\Menu\MenuTreeStorage::getRootPathIds()
File
- core/lib/Drupal/Core/Menu/MenuTreeStorage.php, line 778
Class
- MenuTreeStorage
- Provides a menu tree storage using the database.
Namespace
Drupal\Core\Menu
Code
public function getRootPathIds($id) {
$subquery = $this->connection
->select($this->table, NULL, $this->options);
$subquery
->fields($this->table, [
'p1',
'p2',
'p3',
'p4',
'p5',
'p6',
'p7',
'p8',
'p9',
]);
$subquery
->condition('id', $id);
$result = current($subquery
->execute()
->fetchAll(\PDO::FETCH_ASSOC));
$ids = array_filter($result);
if ($ids) {
$query = $this->connection
->select($this->table, NULL, $this->options);
$query
->fields($this->table, [
'id',
]);
$query
->orderBy('depth', 'DESC');
$query
->condition('mlid', $ids, 'IN');
return $this
->safeExecuteSelect($query)
->fetchAllKeyed(0, 0);
}
return [];
}