diff --git a/core/modules/image/image.install b/core/modules/image/image.install index 1617e8c..a3891ad 100644 --- a/core/modules/image/image.install +++ b/core/modules/image/image.install @@ -6,7 +6,6 @@ */ use Drupal\Component\Uuid\Uuid; -use Drupal\field\Plugin\Core\Entity\Field; /** * Implements hook_install(). @@ -147,22 +146,23 @@ function _image_update_get_style_with_effects(array $style) { * Convert existing image styles to the new config system. */ function image_update_8000() { - $styles = array(); + $language = language_default(); + $uuid = new Uuid(); + $result = db_select('image_styles', NULL, array('fetch' => PDO::FETCH_ASSOC)) ->fields('image_styles') - ->execute() - ->fetchAllAssoc('name', PDO::FETCH_ASSOC); - foreach ($result as $style_name => $style) { - $style['effects'] = _image_update_get_style_with_effects($style); - $styles[$style_name] = $style; - } - - // Convert each style into a configuration object. - foreach ($styles as $name => $style) { - $config = config('image.style.' . $name); - $config->set('name', $name); - $config->set('effects', $style['effects']); - $config->save(); + ->execute(); + foreach ($result as $style) { + // Convert image style into a configuration object. + Drupal::config('image.style.' . $style['name']) + ->set('name', $style['name']) + // @todo Replace with $style['label'] after Drupal 7.23 released. + ->set('label', isset($style['label']) ? $style['label'] : $style['name']) + ->set('uuid', $uuid->generate()) + ->set('status', 1) + ->set('langcode', $language->id) + ->set('effects', _image_update_get_style_with_effects($style)) + ->save(); } }