You are here

function _cache_actions_clear_view in Cache Actions 7

Same name and namespace in other branches
  1. 6.2 cache_actions.rules.inc \_cache_actions_clear_view()
  2. 7.2 cache_actions.rules.inc \_cache_actions_clear_view()

Clear out a view and it's displays.

Parameters

string $view the view machine name:

1 call to _cache_actions_clear_view()
cache_actions_action_clear_views_cache in ./cache_actions.rules.inc
This action clears the cache of a specific view.

File

./cache_actions.rules.inc, line 669
This file provides the rules integration for this module.

Code

function _cache_actions_clear_view($view) {
  $view = views_get_view($view);
  if (is_object($view)) {

    // Go through all displays and clear the cache.
    foreach ($view->display as $display) {

      // If we don't have our own cache plugin, then we need to copy
      // the cache settings from default.
      if (!isset($display->display_options['cache']) && isset($view->display['default'])) {
        $display->display_options['cache'] = $view->display['default']->display_options['cache'];
      }
      _cache_actions_clear_view_display($view, $display);
    }
  }
  else {
    watchdog('cache_actions', "The view %view doesn't exist.\n    You need to look over your rules and see if there's any rules\n    involving that view.", array(
      '%view' => $handler,
    ), WATCHDOG_ERROR);
  }
}