You are here

function manualcrop_form_image_style_form_alter in Manual Crop 7

Implements hook_form_FORM_ID_alter().

File

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

Code

function manualcrop_form_image_style_form_alter(&$form, &$form_state) {
  $style = $form_state['image_style'];
  if (!empty($style['effects'])) {
    if (!is_array($form['#submit'])) {
      $form['#submit'] = array(
        'image_style_form_submit',
      );
    }
    if (variable_get('manualcrop_force_effect_order', TRUE)) {

      // Reorder effects on submit.
      $form['#submit'][] = 'manualcrop_force_effect_order';
    }

    // Update style name in effect data.
    $form['#submit'][] = 'manualcrop_update_style_name';

    // If there's already a Manual Crop effect we have to filter all
    // our effects from the add new effect list.
    if (isset($form['effects']['new']['new'])) {
      foreach ($style['effects'] as $effect) {
        if (_manualcrop_is_own_effect($effect)) {
          $form['effects']['new']['new']['#options'] = array_diff_key($form['effects']['new']['new']['#options'], manualcrop_image_effect_info());
          break;
        }
      }
    }
  }
}