You are here

function scheduler_update_8201 in Scheduler 2.x

Add date fields to any newly supported entity types.

File

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

Code

function scheduler_update_8201() {

  // If modules that have scheduler plugin support are already installed when
  // Scheduler is then upgraded to a version which includes the entity plugins,
  // this update function will add the missing db fields.
  $scheduler_manager = \Drupal::service('scheduler.manager');
  if ($result = $scheduler_manager
    ->entityUpdate()) {
    return t('Added Scheduler date fields to the following entity types: %updated.', [
      '%updated' => implode(', ', $result),
    ]);
  }
  else {
    return t('No database fields had to be added.');
  }
}