function cufon_admin_submit in Cufón 7.2
Same name and namespace in other branches
- 6 cufon.admin.inc \cufon_admin_submit()
Submit callback for cufon administrative settings
Filters out empty form elements.
1 string reference to 'cufon_admin_submit'
- cufon_admin in includes/
cufon.admin.inc - Administration settings page
File
- includes/
cufon.admin.inc, line 167 - Provides the administration page for Cufon.
Code
function cufon_admin_submit($form, &$form_state) {
$selectors = $form_state['values']['cufon_selectors']['selector'];
$remote_url = $form_state['values']['cufon_remote_url'];
foreach ($selectors as $key => $item) {
if (empty($item['selector'])) {
unset($selectors[$key]);
}
else {
// set autoDetect if selected
if ($selectors[$key]['options']['fontFamily'] == 'autoDetect') {
$selectors[$key]['options']['autoDetect'] = TRUE;
unset($selectors[$key]['options']['fontFamily']);
}
else {
unset($selectors[$key]['options']['autoDetect']);
}
// remove unused/empty options
$selectors[$key]['options'] = array_filter($selectors[$key]['options']);
}
}
variable_set('cufon_selectors', $selectors);
variable_set('cufon_remote_url', $remote_url);
drupal_set_message(t('The configuration options have been saved.'));
}