function opigno_learning_path_update_8008 in Opigno Learning path 8
Create new field in learning_path group type.
File
- ./
opigno_learning_path.install, line 285 - Install, update and uninstall functions for the module.
Code
function opigno_learning_path_update_8008() {
$config_path = drupal_get_path('module', 'opigno_learning_path') . '/config/install';
// Update configs from install folder.
$storage = new FileStorage($config_path);
$data = $storage
->read('field.storage.group.field_learning_path_media_image');
if (!FieldStorageConfig::loadByName($data['entity_type'], $data['field_name'])) {
FieldStorageConfig::create($data)
->save();
}
$data = $storage
->read('field.field.group.learning_path.field_learning_path_media_image');
if (!FieldConfig::loadByName($data['entity_type'], $data['bundle'], $data['field_name'])) {
FieldConfig::create($data)
->save();
}
}