function ViewsTestDataHooks::viewUpdate

Implements hook_ENTITY_TYPE_update() for the 'view' entity type.

File

core/modules/views/tests/modules/views_test_data/src/Hook/ViewsTestDataHooks.php, line 27

Class

ViewsTestDataHooks
Hook implementations for views_test_data.

Namespace

Drupal\views_test_data\Hook

Code

public function viewUpdate(ViewEntityInterface $view) {
    // Use state to keep track of how many times a file is saved.
    $view_save_count = \Drupal::state()->get('views_test_data.view_save_count', []);
    $view_save_count[$view->id()] = isset($view_save_count[$view->id()]) ? $view_save_count[$view->id()] + 1 : 1;
    \Drupal::state()->set('views_test_data.view_save_count', $view_save_count);
}

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