1 views_ui.module views_ui_cache_set(&$view)

Specialized cache function to add a flag to our view, include an appropriate include, and cache more easily.

File

core/modules/views_ui/views_ui.module, line 378
Provide structure for the administrative interface to Views.

Code

function views_ui_cache_set(&$view) {
  global $user;

  if (!empty($view->locked)) {
    backdrop_set_message(t('Changes cannot be made to a locked view.'), 'error');
    return;
  }
  $view->changed = TRUE; // let any future object know that this view has changed.

  if (isset($view->current_display)) {
    // Add the knowledge of the changed display, too.
    $view->changed_display[$view->current_display] = TRUE;
    unset($view->current_display);
  }

  // Unset handlers; we don't want to write these into the cache
  unset($view->display_handler);
  unset($view->default_display);
  $view->query = NULL;
  foreach (array_keys($view->display) as $id) {
    unset($view->display[$id]->handler);
    unset($view->display[$id]->default_display);
  }

  // Store the view in the tempstore for up to one week.
  $view->locked = (object) array(
    'uid' => $user->uid,
    'updated' => REQUEST_TIME,
  );
  tempstore_set('views.view', $view->name, $view, REQUEST_TIME + 604800);
  unset($view->locked);
}