function chosen_update_8001 in Chosen 3.0.x
Same name and namespace in other branches
- 8.2 chosen.install \chosen_update_8001()
Renames config to remove redundant 'chosen_' prefix.
File
- ./
chosen.install, line 49 - Installation and uninstallation functions.
Code
function chosen_update_8001() {
$config = \Drupal::configFactory()
->getEditable('chosen.settings');
$raw_data = $config
->getRawData();
foreach ($raw_data as $name => $data) {
if (strpos($name, 'chosen_') === 0) {
unset($raw_data[$name]);
$name = str_replace('chosen_', '', $name);
$raw_data[$name] = $data;
}
}
$config
->setData($raw_data);
$config
->save();
}