Skip to content
Snippets Groups Projects
Commit f9ae34bb authored by Martin Anderson-Clutz's avatar Martin Anderson-Clutz
Browse files

Issue #3431354 by marthinal: Config schema is incorrect

parent 0f4970ce
Branches 8.x-2.x
Tags 8.x-2.4
No related merge requests found
form_mode_control.settings:
type: sequence
type: config_object
label: 'Form Mode Control settings'
sequence:
mapping:
config_value:
type: string
label: 'Config value'
<?php
/**
* Implements hook_update_N().
* Update the schema of form_mode_control.settings configuration.
*/
function form_mode_control_update_9001() {
$config_factory = \Drupal::configFactory();
$config_name = 'form_mode_control.settings';
// Load the old configuration.
$config = $config_factory->getEditable($config_name);
// Get the current sequence values.
$old_values = $config->get('sequence');
// Transform old sequence values to new mapping structure.
if (is_array($old_values)) {
$new_values = [];
foreach ($old_values as $value) {
$new_values[] = ['config_value' => $value];
}
// Clear the old sequence and set the new mapping structure.
$config->clear('sequence');
$config->set('config_value', $new_values);
$config->save();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment