protected function MenuTreeStorage::purgeMultiple in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Menu/MenuTreeStorage.php \Drupal\Core\Menu\MenuTreeStorage::purgeMultiple()
Purges multiple menu links that no longer exist.
Parameters
array $ids: An array of menu link IDs.
1 call to MenuTreeStorage::purgeMultiple()
- MenuTreeStorage::rebuild in core/
lib/ Drupal/ Core/ Menu/ MenuTreeStorage.php - Rebuilds the stored menu link definitions.
File
- core/
lib/ Drupal/ Core/ Menu/ MenuTreeStorage.php, line 213
Class
- MenuTreeStorage
- Provides a menu tree storage using the database.
Namespace
Drupal\Core\MenuCode
protected function purgeMultiple(array $ids) {
$loaded = $this
->loadFullMultiple($ids);
foreach ($loaded as $id => $link) {
if ($link['has_children']) {
$children = $this
->loadByProperties([
'parent' => $id,
]);
foreach ($children as $child) {
$child['parent'] = $link['parent'];
$this
->save($child);
}
}
}
$this
->doDeleteMultiple($ids);
}