You are here

function opigno_learning_path_update_8011 in Opigno Learning path 8

Add "learning_path" field to "user_module_status".

File

./opigno_learning_path.install, line 360
Install, update and uninstall functions for the module.

Code

function opigno_learning_path_update_8011() {
  $definition = BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('Learning path'))
    ->setDescription(t('The learning path whose context the module was taken in.'))
    ->setSetting('target_type', 'group')
    ->setSetting('target_bundles', [
    'learning_path' => 'learning_path',
  ]);
  \Drupal::entityDefinitionUpdateManager()
    ->installFieldStorageDefinition('learning_path', 'user_module_status', 'opigno_learning_path', $definition);
}