function galleria_form_optionset_edit_submit in Galleria 7
Submit handler for 'Save option set' button; Save the changed option set.
File
- includes/
galleria.admin.inc, line 819 - Administrative page callbacks for the galleria module.
Code
function galleria_form_optionset_edit_submit($form, &$form_state) {
$optionset =& $form_state['optionset'];
$optionset->title = $form_state['values']['title'];
$optionset->theme = $form_state['values']['theme'];
$optionset->plugins = $form_state['values']['plugins'];
$optionset->imagestyle_thumb = $form_state['values']['image_styles']['thumb'];
$optionset->imagestyle_normal = $form_state['values']['image_styles']['normal'];
$optionset->imagestyle_big = $form_state['values']['image_styles']['big'];
foreach ($form_state['values']['options'] as $index => $values) {
$element = $form['options'][$index]['value'];
$value = $values['value'];
if ($value !== '') {
// Do some typeguessing here...
if ($element['#type'] == 'checkbox') {
$value = (bool) $value;
}
elseif (is_numeric($value)) {
// || intval($value) != $value || $value < 0)
$value = (double) $value;
}
elseif (strcasecmp($value, 'true') == 0) {
$value = TRUE;
}
elseif (strcasecmp($value, 'false') == 0) {
$value = FALSE;
}
}
$option = $element['#option_name'];
$optionset->options[$option] = $value;
}
ctools_include('export');
ctools_export_crud_save('galleria_optionset', $optionset);
drupal_set_message(t('Option set %name changed.', array(
'%name' => $optionset->name,
)));
$form_state['redirect'] = 'admin/config/media/galleria';
}