function breakpoints_add_style_form_submit in Breakpoints 7
File
- ./
breakpoints.admin.inc, line 691 - Breakpoints - admin settings
Code
function breakpoints_add_style_form_submit($form, &$form_state) {
$base = image_style_load($form_state['values']['style']);
if (!isset($base['effects'])) {
$base['effects'] = array();
}
foreach (array_filter($form_state['values']['breakpoints']) as $breakpoint) {
$new_style = array(
'name' => $form_state['values']['base_name'] . $breakpoint,
);
$style = image_style_save($new_style);
if ($style) {
foreach ($base['effects'] as $effect) {
$effect['isid'] = $style['isid'];
$effect['data']['style_name'] = $new_style['name'];
unset($effect['ieid']);
image_effect_save($effect);
}
}
}
$form_state['redirect'] = 'admin/config/media/image-styles';
drupal_set_message(t('The new styles have been created'));
}