You are here

function views_post_update_serializer_dependencies in Drupal 8

Fix views with serializer dependencies.

File

core/modules/views/views.post_update.php, line 157
Post update functions for Views.

Code

function views_post_update_serializer_dependencies() {
  $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();
    }
  });
}