function ViewUI::cacheSet

Same name in other branches
  1. 9 core/modules/views_ui/src/ViewUI.php \Drupal\views_ui\ViewUI::cacheSet()
  2. 8.9.x core/modules/views_ui/src/ViewUI.php \Drupal\views_ui\ViewUI::cacheSet()
  3. 11.x core/modules/views_ui/src/ViewUI.php \Drupal\views_ui\ViewUI::cacheSet()

Sets a cached view object in the shared tempstore.

3 calls to ViewUI::cacheSet()
ViewUI::standardCancel in core/modules/views_ui/src/ViewUI.php
Submit handler for cancel button.
ViewUI::standardSubmit in core/modules/views_ui/src/ViewUI.php
Basic submit handler applicable to all 'standard' forms.
ViewUI::submitItemAdd in core/modules/views_ui/src/ViewUI.php
Submit handler for adding new item(s) to a view.

File

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

Class

ViewUI
Stores UI related temporary settings.

Namespace

Drupal\views_ui

Code

public function cacheSet() {
    if ($this->isLocked()) {
        \Drupal::messenger()->addError(t('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;
    \Drupal::service('tempstore.shared')->get('views')
        ->set($this->id(), $this);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.