function block_menu_delete

block_menu_delete(Menu $menu)

Implements hook_ENTITY_TYPE_delete() for menu entities.

File

core/modules/block/block.module, line 260
Controls the visual building blocks a page is constructed with.

Code

function block_menu_delete(Menu $menu) {
  if (!$menu->isSyncing()) {
    foreach (Block::loadMultiple() as $block) {
      if ($block->getPluginId() == 'system_menu_block:' . $menu->id()) {
        $block->delete();
      }
    }
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!block!block.module/function/block_menu_delete/8.1.x