public function ViewsRevisionsUI::cacheSet in Config Entity Revisions 8
Same name and namespace in other branches
- 1.x modules/views_revisions/src/ViewsRevisionsUI.php \Drupal\views_revisions\ViewsRevisionsUI::cacheSet()
Sets a cached view object in the shared tempstore.
Overrides ViewUI::cacheSet
File
- modules/
views_revisions/ src/ ViewsRevisionsUI.php, line 17
Class
Namespace
Drupal\views_revisionsCode
public function cacheSet() {
if ($this
->isLocked()) {
\Drupal::messenger()
->addError('Changes cannot be made to a locked view.');
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);
}