public static function MenuLinksController::deleteMenuLinks in Structure Sync 8
Same name and namespace in other branches
- 2.x src/Controller/MenuLinksController.php \Drupal\structure_sync\Controller\MenuLinksController::deleteMenuLinks()
Function to delete all menu links.
1 call to MenuLinksController::deleteMenuLinks()
- MenuLinksController::importMenuLinks in src/
Controller/ MenuLinksController.php - Function to import menu links.
File
- src/
Controller/ MenuLinksController.php, line 409
Class
- MenuLinksController
- Controller for syncing menu links.
Namespace
Drupal\structure_sync\ControllerCode
public static function deleteMenuLinks(&$context) {
$entities = StructureSyncHelper::getEntityManager()
->getStorage('menu_link_content')
->loadMultiple();
StructureSyncHelper::getEntityManager()
->getStorage('menu_link_content')
->delete($entities);
if (array_key_exists('drush', $context) && $context['drush'] === TRUE) {
drush_log('Deleted all (content) menu links', 'ok');
}
StructureSyncHelper::logMessage('Deleted all (content) menu links');
}