function PathPluginBase::postSaveView

Same name and namespace in other branches
  1. 11.x core/modules/views/src/Plugin/views/display/PathPluginBase.php \Drupal\views\Plugin\views\display\PathPluginBase::postSaveView()

Acts on a saved view.

Parameters

\Drupal\views\PostSaveProcess $postSaveProcess: The views save context. Plugins flag work here instead of performing it directly, so it happens at most once per view save. For example, the block plugin queues the block plugin manager via ::addDiscoveryToClear() even if more than one block display changed.

\Drupal\views\Plugin\views\display\DisplayPluginInterface|null $original_display: (optional) The original display. Empty when saving a new view.

Overrides PostSaveViewInterface::postSaveView

File

core/modules/views/src/Plugin/views/display/PathPluginBase.php, line 575

Class

PathPluginBase
The base display plugin for path/callbacks. This is used for pages and feeds.

Namespace

Drupal\views\Plugin\views\display

Code

public function postSaveView(PostSaveProcess $postSaveProcess, ?DisplayPluginInterface $original_display = NULL) : void {
  if ($postSaveProcess->needsRouterRebuild()) {
    return;
  }
  // An empty original display means a new view, we need a router rebuild.
  if (!$original_display) {
    $postSaveProcess->setRouterRebuild();
    return;
  }
  // Rebuild the router when the enclosing view status has changed.
  if ($this->view->storage
    ->status() != $original_display->view->storage
    ->status()) {
    $postSaveProcess->setRouterRebuild();
    return;
  }
  // Rebuild if at least one of the route-affecting options has changed.
  foreach ($this->getRouteAffectingOptions() as $option) {
    if ($this->getOption($option) != $original_display->getOption($option)) {
      $postSaveProcess->setRouterRebuild();
      return;
    }
  }
}

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