From 2a7bf62f20910c096e31e6d1d671b076a0436271 Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Sat, 3 Nov 2012 01:18:07 +0000
Subject: [PATCH] Issue #1828924 by pfrenssen: Convert the Image Style Preview
 Image to CMI.

---
 core/modules/image/config/image.settings.yml |  1 +
 core/modules/image/image.admin.inc           |  2 +-
 core/modules/image/image.install             | 11 +++++++++++
 3 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 core/modules/image/config/image.settings.yml

diff --git a/core/modules/image/config/image.settings.yml b/core/modules/image/config/image.settings.yml
new file mode 100644
index 000000000000..c6dadc8ee59a
--- /dev/null
+++ b/core/modules/image/config/image.settings.yml
@@ -0,0 +1 @@
+preview_image: core/modules/image/sample.png
diff --git a/core/modules/image/image.admin.inc b/core/modules/image/image.admin.inc
index ca55227141b8..933a4ade3c3b 100644
--- a/core/modules/image/image.admin.inc
+++ b/core/modules/image/image.admin.inc
@@ -697,7 +697,7 @@ function theme_image_style_effects($variables) {
 function theme_image_style_preview($variables) {
   $style = $variables['style'];
 
-  $sample_image = variable_get('image_style_preview_image', drupal_get_path('module', 'image') . '/sample.png');
+  $sample_image = config('image.settings')->get('preview_image');
   $sample_width = 160;
   $sample_height = 160;
 
diff --git a/core/modules/image/image.install b/core/modules/image/image.install
index 88f05a121c91..e4e77d859fe9 100644
--- a/core/modules/image/image.install
+++ b/core/modules/image/image.install
@@ -167,3 +167,14 @@ function image_update_8001() {
   db_drop_table('image_styles');
   db_drop_table('image_effects');
 }
+
+/**
+ * Moves image module settings from variable to config.
+ *
+ * @ingroup config_upgrade
+ */
+function image_update_8002() {
+  update_variables_to_config('image.settings', array(
+    'image_style_preview_image' => 'preview_image',
+  ));
+}
-- 
GitLab