You are here

function imageapi_optimize_pipeline_form_add_submit in Image Optimize (or ImageAPI Optimize) 7.2

Submit handler for adding a new image effect to an image pipeline.

1 string reference to 'imageapi_optimize_pipeline_form_add_submit'
imageapi_optimize_pipeline_form in ./imageapi_optimize.admin.inc
Form builder; Edit an image pipeline name and effects order.

File

./imageapi_optimize.admin.inc, line 191

Code

function imageapi_optimize_pipeline_form_add_submit($form, &$form_state) {
  $pipeline = $form_state['pipeline'];

  // Check if this field has any configuration options.
  $processor = imageapi_optimize_processor_definition_load($form_state['values']['new']);
  $processor_handler = imageapi_optimize_processor_handler($processor);

  // Load the configuration form for this option.
  if (is_a($processor_handler, 'ImageAPIOptimizeProcessorConfigurableInterface')) {
    $path = 'admin/config/media/imageapi-optimize/edit/' . $form_state['pipeline']['name'] . '/add/' . $form_state['values']['new'];
    $form_state['redirect'] = array(
      $path,
      array(
        'query' => array(
          'weight' => $form_state['values']['weight'],
        ),
      ),
    );
  }
  else {
    $processor['isid'] = $pipeline['isid'];
    $processor['weight'] = $form_state['values']['weight'];
    imageapi_optimize_processor_save($processor);
    drupal_set_message(t('The imageapi optimize processor was successfully applied.'));
  }
}