function opigno_class_update_8002 in Opigno class 8
Update class roles.
File
- ./
opigno_class.install, line 36 - Install, update and uninstall functions for the Opigno Class module.
Code
function opigno_class_update_8002() {
// Remove old configs.
$configs = [
'group.role.opigno_class-admin',
'group.role.opigno_class-student',
'group.role.opigno_class-coach',
];
foreach ($configs as $config) {
try {
\Drupal::configFactory()
->getEditable($config)
->delete();
} catch (Exception $e) {
\Drupal::logger('opigno_class')
->error($e
->getMessage());
}
}
$config_path = drupal_get_path('module', 'opigno_class') . '/config/install';
$source = new FileStorage($config_path);
$config_storage = \Drupal::service('config.storage');
$config_storage
->write('group.role.opigno_class-class_manager', $source
->read('group.role.opigno_class-class_manager'));
}