1.20.x image.admin.inc | image_style_form_submit($form, &$form_state) |
Submit handler for saving an image style.
File
- modules/
image/ image.admin.inc, line 185 - Admin page callbacks for the Image module.
Code
function image_style_form_submit($form, &$form_state) {
$style = $form_state['image_style'];
// Update the image style.
$style['label'] = $form_state['values']['label'];
if (isset($form_state['values']['name']) && $style['name'] != $form_state['values']['name']) {
$style['old_name'] = $style['name'];
$style['name'] = $form_state['values']['name'];
}
// 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 = array(
'name' => $style['effects'][$ieid]['name'],
'data' => $style['effects'][$ieid]['data'],
'weight' => $effect_data['weight'],
);
$style['effects'][$ieid] = $effect;
}
}
}
image_style_save($style);
if ($form_state['values']['op'] == t('Update style')) {
backdrop_set_message(t('Changes to the style have been saved.'));
}
$form_state['redirect'] = 'admin/config/media/image-styles/configure/' . $style['name'];
}