You are here

function opigno_ilt_update_8003 in Opigno Instructor-led Trainings 8

Add "trainer" field to "opigno_ilt".

File

./opigno_ilt.install, line 89
Install, update and uninstall functions for the Opigno ILT module.

Code

function opigno_ilt_update_8003() {

  // Add new field.
  $definition = BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('Trainer'))
    ->setDescription(t('The trainer of the ILT entity.'))
    ->setSetting('target_type', 'user')
    ->setSetting('handler', 'default');
  \Drupal::entityDefinitionUpdateManager()
    ->installFieldStorageDefinition('trainer', 'opigno_ilt', 'opigno_ilt', $definition);
}