You are here

function manualcrop_add_effect_info in Manual Crop 7

Effect form submit handler; Adds some extra info (style name and weight) to the effect.

1 string reference to 'manualcrop_add_effect_info'
manualcrop_form_image_effect_form_alter in ./manualcrop.admin.inc
Implements hook_form_FORM_ID_alter().

File

./manualcrop.admin.inc, line 428
Admin functionality for the Manual Crop module.

Code

function manualcrop_add_effect_info($form, &$form_state) {
  $style = $form_state['image_style'];
  $effect = $form_state['image_effect'];
  if (_manualcrop_is_own_effect($form_state['image_effect'], TRUE)) {

    // Set style name so the effect can use it.
    $form_state['values']['data']['style_name'] = $style['name'];
  }
  if (empty($style['effects'])) {

    // First effect, so weight is 0.
    $form_state['values']['weight'] = 0;
  }
  elseif (!isset($effect['ieid'])) {

    // New effect, the weight must be the weight of the first effect minus one.
    $first = reset($style['effects']);
    $form_state['values']['weight'] = $first['weight'] - 1;
  }
}