Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d7 / hook / image_style_save.twig
diff --git a/vendor/chi-teck/drupal-code-generator/templates/d7/hook/image_style_save.twig b/vendor/chi-teck/drupal-code-generator/templates/d7/hook/image_style_save.twig
new file mode 100644 (file)
index 0000000..b489997
--- /dev/null
@@ -0,0 +1,10 @@
+/**
+ * Implements hook_image_style_save().
+ */
+function {{ machine_name }}_image_style_save($style) {
+  // If a module defines an image style and that style is renamed by the user
+  // the module should update any references to that style.
+  if (isset($style['old_name']) && $style['old_name'] == variable_get('mymodule_image_style', '')) {
+    variable_set('mymodule_image_style', $style['name']);
+  }
+}