You are here

function image_style_form_add_submit in Drupal 7

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 modules/image/image.admin.inc
Form builder; Edit an image style name and effects order.

File

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'],
        ),
      ),
    );
  }
  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.'));
  }
}