Currently we have this:
<?php
function menu_menu_delete(Menu $menu) {
menu_cache_clear_all();
// Invalidate the block cache to update menu-based derivatives.
if (module_exists('block')) {
drupal_container()->get('plugin.manager.block')->clearCachedDefinitions();
}
}
?>
Which leads to awkward requirements like in #1978244: Allow for optional dependencies.
Let's just do this instead:
<?php
<?php
use Drupal\Core\Cache\Cache;
function menu_menu_delete(Menu $menu) {
menu_cache_clear_all();
Cache::invalidateTags(array('block_definitions'=> TRUE);
}
?>
Note: this would require changing block manager's cache tag to block_definitions, which I think makes sense.