You are here

function opigno_moxtra_update_8010 in Opigno Moxtra 8

Creates the auto_register field in workspaces.

File

./opigno_moxtra.install, line 267
Install, update and uninstall functions for the Opigno Moxtra module.

Code

function opigno_moxtra_update_8010() {

  // Create a new field definition.
  $field = BaseFieldDefinition::create('boolean')
    ->setLabel(t('Automatically register'))
    ->setDescription(t('Automatically register all users of that training.'))
    ->setRevisionable(TRUE)
    ->setTranslatable(TRUE)
    ->setDefaultValue(TRUE)
    ->setDisplayOptions('form', [
    'type' => 'boolean_checkbox',
    'weight' => 2,
  ]);

  // Install the new definition.
  $definition_manager = \Drupal::entityDefinitionUpdateManager();
  $definition_manager
    ->installFieldStorageDefinition('auto_register', 'opigno_moxtra_workspace', 'opigno_moxtra_workspace', $field);
}