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

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

File

core/modules/image/image.admin.inc, line 160
Admin page callbacks for the Image module.

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/configure/' . $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 = array(
      'name' => $effect['name'],
      'data' => array(),
      'weight' => $form_state['values']['weight'],
    );
    image_effect_save($style['name'], $effect);
    backdrop_set_message(t('The image effect was successfully applied.'));
  }
}