You are here

function opigno_moxtra_update_8002 in Opigno Moxtra 8

Creates the collaborative workspace field in training groups.

File

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

Code

function opigno_moxtra_update_8002() {
  $config_path = drupal_get_path('module', 'opigno_moxtra') . '/config/install';
  $storage = new FileStorage($config_path);
  $data = $storage
    ->read('field.storage.group.field_workspace');
  if (!FieldStorageConfig::loadByName($data['entity_type'], $data['field_name'])) {
    FieldStorageConfig::create($data)
      ->save();
  }
  $data = $storage
    ->read('field.field.group.learning_path.field_workspace');
  if (!FieldConfig::loadByName($data['entity_type'], $data['bundle'], $data['field_name'])) {
    FieldConfig::create($data)
      ->save();
  }
}