Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. views.module

function views_invalidate_cache

Invalidate the views cache, forcing a rebuild on the next grab of table data.

3 calls to views_invalidate_cache()
AdvancedSettingsForm::cacheSubmit in core/modules/views_ui/src/Form/AdvancedSettingsForm.php
Submission handler to clear the Views cache.
View::postDelete in core/modules/views/src/Entity/View.php
Acts on deleted entities before the delete hook is invoked.
View::postSave in core/modules/views/src/Entity/View.php
Acts on a saved entity before the insert or update hook is invoked.
1 string reference to 'views_invalidate_cache'
views_hook_info in core/modules/views/views.module
Implements hook_hook_info().

File

core/modules/views/views.module, line 196

Code

function views_invalidate_cache() {
    // Set the menu as needed to be rebuilt.
    \Drupal::service('router.builder')->setRebuildNeeded();
    $module_handler = \Drupal::moduleHandler();
    // Reset the RouteSubscriber from views.
    \Drupal::getContainer()->get('views.route_subscriber')
        ->reset();
    // Invalidate the block cache to update views block derivatives.
    if ($module_handler->moduleExists('block')) {
        \Drupal::service('plugin.manager.block')->clearCachedDefinitions();
    }
    // Allow modules to respond to the Views cache being cleared.
    $module_handler->invokeAll('views_invalidate_cache');
}
RSS feed
Powered by Drupal