Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291123

Use cachetags to invalidate block definitions

$
0
0

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.


Viewing all articles
Browse latest Browse all 291123

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>