You are here

function imagecrop_form_image_effect_form_alter in Image javascript crop 7

Implements hook_form_image_effect_form_alter(). Add the reset checkbox when editing an effect.

File

./imagecrop.module, line 230
Provides a javascript toolbox through an imagecache action.

Code

function imagecrop_form_image_effect_form_alter(&$form, $form_state, $form_id) {
  if (!empty($form['data']['width']['#default_value']) && !empty($form['data']['height']['#default_value'])) {
    $form['reset-crops'] = array(
      '#type' => 'checkbox',
      '#title' => t('Reset the already cropped images to the new width and height'),
      '#description' => t('All crop selections that have the same width / height as old settings, will be updated to the new width and height.'),
      '#weight' => -1,
    );
    $form['old-height'] = array(
      '#type' => 'hidden',
      '#value' => $form['data']['height']['#default_value'],
    );
    $form['old-width'] = array(
      '#type' => 'hidden',
      '#value' => $form['data']['width']['#default_value'],
    );
    $form['#submit'][] = 'imagecrop_javascript_effect_submit';
  }
}