function MenuTreeStorage::purgeMultiple
Same name in other branches
- 9 core/lib/Drupal/Core/Menu/MenuTreeStorage.php \Drupal\Core\Menu\MenuTreeStorage::purgeMultiple()
- 10 core/lib/Drupal/Core/Menu/MenuTreeStorage.php \Drupal\Core\Menu\MenuTreeStorage::purgeMultiple()
- 11.x 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);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.