function views_post_update_taxonomy_index_tid

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

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();
    }
  });
}

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