You are here

function manualcrop_update_7104 in Manual Crop 7

Remove unneeded image effect data and rename the "reusestyle" setting to "reuse_crop_style".

File

./manualcrop.install, line 288
Install, update and uninstall functions for the Manual Crop module.

Code

function manualcrop_update_7104(&$sandbox) {
  require_once 'manualcrop.helpers.inc';
  foreach (manualcrop_styles_with_crop(TRUE) as $info) {
    $effect = $info['effect'];
    $save = FALSE;
    if (_manualcrop_is_own_effect($effect, FALSE)) {

      // Remove the style_name setting.
      if (isset($effect['data']['style_name'])) {
        unset($effect['data']['style_name']);
        $save = TRUE;
      }

      // Rename the reusestyle setting.
      if (isset($effect['data']['reusestyle'])) {
        $effect['data']['reuse_crop_style'] = $effect['data']['reusestyle'];
        unset($effect['data']['reusestyle']);
        $save = TRUE;
      }
      if ($save) {
        image_effect_save($effect);
      }
    }
  }
}