diff --git a/core/modules/views/views.install b/core/modules/views/views.install index 03d9e72..d8becfe 100644 --- a/core/modules/views/views.install +++ b/core/modules/views/views.install @@ -495,7 +495,7 @@ function views_update_8300() { // could already be using the correct field. Like // user__roles/roles_target_id. if (isset($table_update_info[$table][$original_field_name])) { - $required_cleanup_handlers[] = [$id, $path_to_handler]; + $required_cleanup_handlers[$id][] = $path_to_handler; // Set both the new table field as well as new 'plugin_id' field. $view->set($path_field, $table_update_info[$table][$original_field_name]); @@ -517,40 +517,42 @@ function views_update_8300() { // keys so he configuration applies to the config schema. // We cannot do that inline in the other code, due to caching issues with // typed configuration. - foreach ($required_cleanup_handlers as list($id, $path_to_handler)) { + foreach ($required_cleanup_handlers as $id => $paths_to_handlers) { $changed = FALSE; - /** @var \Drupal\Core\Config\Schema\TypedConfigInterface $typed_view */ $typed_view = $typed_config_manager->get($id); $view = $config_factory->getEditable($id); - - /** @var \Drupal\Core\Config\Schema\ArrayElement $typed_config */ - $typed_config = $typed_view->get($path_to_handler); - $config = $typed_config->getValue(); - - // Filter values we want to convert from a string to an array. - if (strpos($path_to_handler, 'filters') !== 0 && $typed_config->getDataDefinition()['mapping']['value'] instanceof ArrayElement && is_string($config['value'])) { - // An empty string casted to an array is an array with one - // element. - if ($config['value'] === '') { - $config['value'] = []; - } - else { - $config['value'] = (array) $config['value']; + foreach ($paths_to_handlers as $path_to_handler) { + /** @var \Drupal\Core\Config\Schema\TypedConfigInterface $typed_view */ + + /** @var \Drupal\Core\Config\Schema\ArrayElement $typed_config */ + $typed_config = $typed_view->get($path_to_handler); + $config = $typed_config->getValue(); + + // Filter values we want to convert from a string to an array. + if (strpos($path_to_handler, 'filters') !== FALSE && $typed_config->get('value') instanceof ArrayElement && is_string($config['value'])) { + // An empty string casted to an array is an array with one + // element. + if ($config['value'] === '') { + $config['value'] = []; + } + else { + $config['value'] = (array) $config['value']; + } } - } - // For all the other fields we try to determine the fields using - // config schema and remove everything which is not needed. - foreach (array_keys($config) as $config_key) { - if (!isset($typed_config->getDataDefinition()['mapping'][$config_key])) { - unset($config[$config_key]); - $changed = TRUE; + // For all the other fields we try to determine the fields using + // config schema and remove everything which is not needed. + foreach (array_keys($config) as $config_key) { + if (!isset($typed_config->getDataDefinition()['mapping'][$config_key])) { + unset($config[$config_key]); + $changed = TRUE; + } } + $typed_config->setValue($config); + $view->set($path_to_handler, $typed_config->getValue()); } - $typed_config->setValue($config); if ($changed) { - $view->set($path_to_handler, $typed_config->getValue()); $view->save(); } }