You are here

function imageapi_optimize_form_image_style_form_alter in Image Optimize (or ImageAPI Optimize) 7.2

Implements hook_form_FORM_ID_alter().

File

./imageapi_optimize.module, line 855

Code

function imageapi_optimize_form_image_style_form_alter(&$form, &$form_state, $form_id) {
  $form['#validate'][] = 'imageapi_optimize_form_image_style_validate';
  $form['effects']['new']['add']['#validate'][] = 'imageapi_optimize_form_image_style_validate';

  // We only allow our effect to be added to a style once.
  $style = $form_state['image_style'];
  foreach ($style['effects'] as $effect) {
    if ($effect['name'] == 'imageapi_optimize') {
      unset($form['effects']['new']['new']['#options']['imageapi_optimize']);
    }
  }
}