You are here

function opigno_module_update_8004 in Opigno module 8

Creates the hide_results field in opigno_module.

File

./opigno_module.install, line 392
Opigno module app install/update functionality.

Code

function opigno_module_update_8004() {

  // Create a new field definition.
  $field = BaseFieldDefinition::create('boolean')
    ->setLabel(t('Do not display results at the end of the module'))
    ->setDescription(t('If you check this option, the correct answers won’t be displayed to the users at the end of the module.'))
    ->setRevisionable(TRUE)
    ->setTranslatable(TRUE)
    ->setDefaultValue(FALSE)
    ->setDisplayOptions('form', [
    'type' => 'boolean_checkbox',
    'weight' => 2,
  ]);

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