function skinr_ui_skinsets_settings_form_submit in Skinr 6.2
Process skinr_ui_skinsets_settings_form form submissions.
File
- ./
skinr_ui.admin.inc, line 563 - Admin page callbacks for the skinr module.
Code
function skinr_ui_skinsets_settings_form_submit($form, &$form_state) {
if ($form_state['values']['op'] == t('Save configuration')) {
foreach ($form_state['values'] as $skin_name => $skin) {
if (is_array($form_state['values'][$skin_name]['status'])) {
$skinr_skin = new StdClass();
$skinr_skin->name = $form_state['values']['skinset'];
$skinr_skin->type = 'skinset';
$skinr_skin->skin = $skin_name;
$skinr_skin->status = _skinr_array_strip_empty($form_state['values'][$skin_name]['status']);
if (db_result(db_query("SELECT 1 FROM {skinr_skins} WHERE name = '%s' AND skin = '%s'", $skinr_skin->name, $skinr_skin->skin))) {
// Record exists, so let's update.
drupal_write_record('skinr_skins', $skinr_skin, array(
'name',
'skin',
));
}
else {
// Insert a new record.
drupal_write_record('skinr_skins', $skinr_skin);
}
}
}
}
else {
// Revert to defaults: disable all skinsets.
}
drupal_set_message(t('The configuration options have been saved.'));
$form_state['redirect'] = 'admin/build/skinr/skins';
return;
}