You are here

function image_example_image_style_save in Examples for Developers 7

Implements hook_image_style_save().

Allows modules to respond to updates to an image style's settings.

Related topics

File

image_example/image_example.module, line 136
Module file for image_example

Code

function image_example_image_style_save($style) {

  // The $style parameter is an image style array with one notable exception.
  // When a user has chosen to replace a deleted style with another style the
  // $style['name'] property contains the name of the replacement style and
  // $style['old_name'] contains the name of the style being deleted.
  //
  // Here we update a variable that contains the name of the image style that
  // the block provided by this module uses when formatting images to use the
  // new user chosen style name.
  if (isset($style['old_name']) && $style['old_name'] == variable_get('image_example_style_name', '')) {
    variable_set('image_example_style_name', $style['name']);
  }
}