ViewUI::cacheSet

public ViewUI::cacheSet()

Sets a cached view object in the user tempstore.

File

core/modules/views_ui/src/ViewUI.php, line 857

Class

ViewUI
Stores UI related temporary settings.

Namespace

Drupal\views_ui

Code

public function cacheSet() {
  if ($this->isLocked()) {
    drupal_set_message(t('Changes cannot be made to a locked view.'), 'error');
    return;
  }

  // Let any future object know that this view has changed.
  $this->changed = TRUE;

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

  // Unset handlers. We don't want to write these into the cache.
  $executable->display_handler = NULL;
  $executable->default_display = NULL;
  $executable->query = NULL;
  $executable->displayHandlers = NULL;
  \Drupal::service('user.shared_tempstore')->get('views')->set($this->id(), $this);
}
doc_Drupal
2016-10-29 09:55:53
Comments
Leave a Comment

Please login to continue.