function views_post_update_taxonomy_index_tid in Drupal 8
Fix views with dependencies on taxonomy terms that don't exist.
1 call to views_post_update_taxonomy_index_tid()
- TaxonomyIndexTidFilterTest::testPostUpdateFunction in core/
modules/ taxonomy/ tests/ src/ Kernel/ Views/ TaxonomyIndexTidFilterTest.php - Tests post update function fixes dependencies.
File
- core/
modules/ views/ views.post_update.php, line 143 - Post update functions for Views.
Code
function views_post_update_taxonomy_index_tid() {
$views = View::loadMultiple();
array_walk($views, function (View $view) {
$old_dependencies = $view
->getDependencies();
$new_dependencies = $view
->calculateDependencies()
->getDependencies();
if ($old_dependencies !== $new_dependencies) {
$view
->save();
}
});
}