function block_menu_delete

Same name in other branches
  1. 7.x modules/block/block.module \block_menu_delete()
  2. 9 core/modules/block/block.module \block_menu_delete()
  3. 8.9.x core/modules/block/block.module \block_menu_delete()
  4. 11.x core/modules/block/block.module \block_menu_delete()

Implements hook_ENTITY_TYPE_delete() for menu entities.

File

core/modules/block/block.module, line 293

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();
            }
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.