public function MongodbMenuTreeStorage::getExpanded in MongoDB 8
Finds expanded links in a menu given a set of possible parents.
Parameters
string $menu_name: The menu name.
array $parents: One or more parent IDs to match.
Return value
array The menu link IDs that are flagged as expanded in this menu.
Overrides MenuTreeStorage::getExpanded
File
- src/
MongodbMenuTreeStorage.php, line 133 - Contains \Drupal\mongodb\MongodbMenuTreeStorage .
Class
Namespace
Drupal\mongodbCode
public function getExpanded($menu_name, array $parents) {
$id_query['value.menu_name'] = $menu_name;
$id_query['value.id']['$in'] = array_values($parents);
$ps = [];
foreach ($this
->mongoCollection()
->find($id_query, [
'value.p' => 1,
]) as $link) {
$ps[] = preg_quote($link['value']['p'], '/') . '.';
}
$query['value.menu_name'] = $menu_name;
$query['value.expanded'] = 1;
$query['value.has_children'] = 1;
$query['value.enabled'] = 1;
$query['value.p'] = new \MongoRegex('/^' . implode('|', $ps) . '/');
return $this
->getIds($query);
}