function image_style_form_submit

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

Submit handler for saving an image style.

1 string reference to 'image_style_form_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 212
Administration pages for image settings.

Code

function image_style_form_submit($form, &$form_state) {
  // Update the image style.
  $style = $form_state['image_style'];
  $style['name'] = $form_state['values']['name'];
  $style['label'] = $form_state['values']['label'];

  // Update image effect weights.
  if (!empty($form_state['values']['effects'])) {
    foreach ($form_state['values']['effects'] as $ieid => $effect_data) {
      if (isset($style['effects'][$ieid])) {
        $effect = $style['effects'][$ieid];
        $effect['weight'] = $effect_data['weight'];
        image_effect_save($effect);
      }
    }
  }

  image_style_save($style);
  if ($form_state['values']['op'] == t('Update style')) {
    drupal_set_message(t('Changes to the style have been saved.'));
  }
  $form_state['redirect'] = 'admin/config/media/image-styles/edit/' . $style['name'];
}