public function ViewRevisionsUI::cacheSet in Config Entity Revisions 8.2
Sets a cached view object in the shared tempstore.
Overrides ViewUI::cacheSet
File
- modules/
view_revisions/ src/ ViewRevisionsUI.php, line 18
Class
- ViewRevisionsUI
- Class ViewRevisionsUI.
Namespace
Drupal\view_revisionsCode
public function cacheSet() {
if ($this
->isLocked()) {
\Drupal::messenger()
->addMessage(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;
$revId = $this
->get('storage')
->get('loadedRevisionId');
$cacheId = $revId ? $this
->id() . '-' . $revId : $this
->id();
$this->storage->entityTypeManager = NULL;
$this->entityTypeManager = NULL;
\Drupal::service('tempstore.shared')
->get('views')
->set($cacheId, $this);
}