function opigno_module_update_8020 in Opigno module 8
Add skill types for activities. Add level names.
File
- ./
opigno_module.install, line 1210 - Opigno module app install/update functionality.
Code
function opigno_module_update_8020() {
$definition_manager = \Drupal::entityDefinitionUpdateManager();
$field = BaseFieldDefinition::create('boolean')
->setLabel(t('Use activity in auto skills management'))
->setRevisionable(TRUE)
->setTranslatable(TRUE)
->setDefaultValue(FALSE)
->setDisplayOptions('form', array(
'type' => 'boolean_checkbox',
'weight' => 1,
));
$definition_manager
->installFieldStorageDefinition('auto_skills', 'opigno_activity', 'opigno_module', $field);
$config_path = drupal_get_path('module', 'opigno_skills_system') . '/config/optional';
$storage = new FileStorage($config_path);
$config_storage = \Drupal::service('config.storage');
$data = $storage
->read('core.entity_form_display.taxonomy_term.skills.default');
$config_storage
->write('core.entity_form_display.taxonomy_term.skills.default', $data);
$data = $storage
->read('core.entity_view_display.taxonomy_term.skills.default');
$config_storage
->write('core.entity_view_display.taxonomy_term.skills.default', $data);
$data = $storage
->read('field.field.taxonomy_term.skills.field_level_names');
$config_storage
->write('field.field.taxonomy_term.skills.field_level_names', $data);
$data = $storage
->read('field.storage.taxonomy_term.field_level_names');
$config_storage
->write('field.storage.taxonomy_term.field_level_names', $data);
}