protected function MenuTreeStorage::findNoLongerExistingLinks in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Menu/MenuTreeStorage.php \Drupal\Core\Menu\MenuTreeStorage::findNoLongerExistingLinks()
- 9 core/lib/Drupal/Core/Menu/MenuTreeStorage.php \Drupal\Core\Menu\MenuTreeStorage::findNoLongerExistingLinks()
Find any previously discovered menu links that no longer exist.
Parameters
array $definitions: The new menu link definitions.
Return value
array A list of menu link IDs that no longer exist.
File
- core/
lib/ Drupal/ Core/ Menu/ MenuTreeStorage.php, line 1461
Class
- MenuTreeStorage
- Provides a menu tree storage using the database.
Namespace
Drupal\Core\MenuCode
protected function findNoLongerExistingLinks(array $definitions) {
if ($definitions) {
$query = $this->connection
->select($this->table, NULL, $this->options);
$query
->addField($this->table, 'id');
$query
->condition('discovered', 1);
$query
->condition('id', array_keys($definitions), 'NOT IN');
// Starting from links with the greatest depth will minimize the amount
// of re-parenting done by the menu storage.
$query
->orderBy('depth', 'DESC');
$result = $query
->execute()
->fetchCol();
}
else {
$result = [];
}
return $result;
}