function ViewsEntitySchemaSubscriber::revisionRemoval

Same name in other branches
  1. 8.9.x core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php \Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber::revisionRemoval()
  2. 10 core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php \Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber::revisionRemoval()
  3. 11.x core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php \Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber::revisionRemoval()

Updates views if revision support is removed.

Parameters

\Drupal\views\Entity\View[] $all_views: All views.

\Drupal\Core\Entity\EntityTypeInterface $original: The origin entity type.

1 call to ViewsEntitySchemaSubscriber::revisionRemoval()
ViewsEntitySchemaSubscriber::onEntityTypeUpdate in core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php
Reacts to the update of the entity type.

File

core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php, line 412

Class

ViewsEntitySchemaSubscriber
Reacts to changes on entity types to update all views entities.

Namespace

Drupal\views\EventSubscriber

Code

protected function revisionRemoval($all_views, EntityTypeInterface $original) {
    $revision_base_table = $original->getRevisionTable();
    $revision_data_table = $original->getRevisionDataTable();
    foreach ($all_views as $view) {
        if (in_array($view->get('base_table'), [
            $revision_base_table,
            $revision_data_table,
        ])) {
            // Let's disable the views as we no longer support revisions.
            $view->setStatus(FALSE);
            $this->viewsToSave[$view->id()] = $view;
        }
        // For any kind of field, let's rely on the broken handler functionality.
    }
}

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