function ViewsEntitySchemaSubscriber::baseTableRename
Same name in other branches
- 8.9.x core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php \Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber::baseTableRename()
- 10 core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php \Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber::baseTableRename()
- 11.x core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php \Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber::baseTableRename()
Updates views if a base table is renamed.
Parameters
\Drupal\views\Entity\View[] $all_views: All views.
string $entity_type_id: The entity type ID.
string $old_base_table: The old base table name.
string $new_base_table: The new base table name.
1 call to ViewsEntitySchemaSubscriber::baseTableRename()
- 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 302
Class
- ViewsEntitySchemaSubscriber
- Reacts to changes on entity types to update all views entities.
Namespace
Drupal\views\EventSubscriberCode
protected function baseTableRename($all_views, $entity_type_id, $old_base_table, $new_base_table) {
foreach ($all_views as $view) {
if ($view->get('base_table') == $old_base_table) {
$view->set('base_table', $new_base_table);
$this->viewsToSave[$view->id()] = $view;
}
}
$this->processHandlers($all_views, function (&$handler_config, ViewEntityInterface $view) use ($entity_type_id, $old_base_table, $new_base_table) {
if (isset($handler_config['entity_type']) && $handler_config['entity_type'] == $entity_type_id && $handler_config['table'] == $old_base_table) {
$handler_config['table'] = $new_base_table;
$this->viewsToSave[$view->id()] = $view;
}
});
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.