ViewRevisionsUI.php in Config Entity Revisions 8.2
Namespace
Drupal\view_revisionsFile
modules/view_revisions/src/ViewRevisionsUI.phpView source
<?php
namespace Drupal\view_revisions;
use Drupal\views_ui\ViewUI;
use Drupal\config_entity_revisions\ConfigEntityRevisionsConfigEntityContainerInterface;
/**
* Class ViewRevisionsUI.
*
* @package Drupal\view_revisions
*/
class ViewRevisionsUI extends ViewUI implements ConfigEntityRevisionsConfigEntityContainerInterface {
/**
* Sets a cached view object in the shared tempstore.
*/
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);
}
/**
* Get the revisioned entity (storage in this case).
*
* @return \Drupal\Core\Config\Entity\ConfigEntityBase
* The revisioned config entity.
*/
public function revisionedEntity() {
return $this
->get('storage');
}
}
Classes
Name | Description |
---|---|
ViewRevisionsUI | Class ViewRevisionsUI. |