You are here

function opigno_learning_path_update_8014 in Opigno Learning path 8

Creates Guided Navigation field in the learning path group type.

File

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

Code

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