function image_style_form_add_submit

7.x image.admin.inc image_style_form_add_submit($form, &$form_state)

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

1 string reference to 'image_style_form_add_submit'
image_style_form in drupal-7.x/modules/image/image.admin.inc
Form builder; Edit an image style name and effects order.

File

drupal-7.x/modules/image/image.admin.inc, line 182
Administration pages for image settings.

Code

function image_style_form_add_submit($form, &$form_state) {
  $style = $form_state['image_style'];
  // Check if this field has any configuration options.
  $effect = image_effect_definition_load($form_state['values']['new']);

  // Load the configuration form for this option.
  if (isset($effect['form callback'])) {
    $path = 'admin/config/media/image-styles/edit/' . $form_state['image_style']['name'] . '/add/' . $form_state['values']['new'];
    $form_state['redirect'] = array($path, array('query' => array('weight' => $form_state['values']['weight'])));
  }
  // If there's no form, immediately add the image effect.
  else {
    $effect['isid'] = $style['isid'];
    $effect['weight'] = $form_state['values']['weight'];
    image_effect_save($effect);
    drupal_set_message(t('The image effect was successfully applied.'));
  }
}