function image_config_import_change

Implements hook_config_import_change().

File

drupal/core/modules/image/image.module, line 520
Exposes global functionality for creating image styles.

Code

function image_config_import_change($name, $new_config, $old_config) {

  // Only image styles require custom handling. Any other module settings can be
  // synchronized directly.
  if (strpos($name, 'image.style.') !== 0) {
    return FALSE;
  }
  list(, , $id) = explode('.', $name);
  $style = entity_load('image_style', $id);
  $style->original = clone $style;
  foreach ($old_config
    ->get() as $property => $value) {
    $style->original->{$property} = $value;
  }
  foreach ($new_config
    ->get() as $property => $value) {
    $style->{$property} = $value;
  }
  $style
    ->save();
  return TRUE;
}