function webform_update_8035 in Webform 6.x
Same name and namespace in other branches
- 8.5 includes/webform.install.update.inc \webform_update_8035()
Issue #2867529: Email handler states setting should be index array.
File
- includes/
webform.install.update.inc, line 758 - Archived Webform update hooks.
Code
function webform_update_8035() {
$config_factory = \Drupal::configFactory();
foreach ($config_factory
->listAll('webform.webform.') as $webform_config_name) {
$webform_config = $config_factory
->getEditable($webform_config_name);
$data = $webform_config
->getRawData();
$has_handler = FALSE;
foreach ($data['handlers'] as &$handler) {
if ($handler['id'] === 'email') {
if (isset($handler['settings']['states']) && is_array($handler['settings']['states'])) {
$handler['settings']['states'] = array_values(array_filter($handler['settings']['states']));
}
}
}
if ($has_handler) {
$webform_config
->setData($data);
$webform_config
->save();
}
}
}