You are here

function configuration_revert_image_style in Configuration Management 7

Restore the values from the datastore when an image style is reverted.

1 string reference to 'configuration_revert_image_style'
configuration_form_image_style_revert_form_alter in observers/observer.image.inc
Implements hook_form_FORM_ID_alter().

File

observers/observer.image.inc, line 42
I'll probably end up putting this code in configuration.image.inc. Just want to keep it separate for now, while I get this working.

Code

function configuration_revert_image_style($form, $form_state) {
  if (!empty($form_state['image_style']['name'])) {
    $identifier = $form_state['image_style']['name'];
    $cache = cache_get("image:{$identifier}", 'cache_configuration');
    $cache->data['image'][$identifier]['activestore'] = $cache->data['image'][$identifier]['datastore'];
    cache_set('image:' . $identifier, $cache->data['image'][$identifier], 'cache_configuration');
    configuration_set_status('image', $identifier, CONFIGURATION_IN_SYNC);
    configuration_check_configurations(TRUE);
  }
}