You are here

function opigno_learning_path_update_8006 in Opigno Learning path 8

Creates enable forum field in the learning path group type.

File

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

Code

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