function tmgmt_update_8003

Add type field to Job entity.

File

./tmgmt.install, line 50
Update function for the tmgmt module.

Code

function tmgmt_update_8003() {
  $storage_definition = BaseFieldDefinition::create('list_string')
    ->setLabel(t('Job type'))
    ->setDescription(t('Type of job entity, can be Normal or Continuous.'))
    ->setSetting('allowed_values', [
    Job::TYPE_NORMAL,
    Job::TYPE_CONTINUOUS,
  ])
    ->setDefaultValue(Job::TYPE_NORMAL);
  \Drupal::entityDefinitionUpdateManager()
    ->installFieldStorageDefinition('job_type', 'tmgmt_job', 'tmgmt', $storage_definition);
}