You are here

function scheduler_update_8202 in Scheduler 2.x

Refresh views for supported entity types.

File

./scheduler.install, line 144
Installation file for Scheduler module.

Code

function scheduler_update_8202() {

  // The scheduled content view needs to be refreshed from source when upgrading
  // to the entity plugin version of Scheduler. If the media or commerce modules
  // are already enabled this will also load those new views from source.
  $scheduler_manager = \Drupal::service('scheduler.manager');
  if ($result = $scheduler_manager
    ->viewsUpdate()) {
    return t('Updated views: %updated.', [
      '%updated' => implode(', ', $result),
    ]);
  }
  else {
    return t('No views require updating.');
  }
}