function beautytips_admin_submit in BeautyTips 6.2
Same name and namespace in other branches
- 6 beautytips.module \beautytips_admin_submit()
- 7.2 beautytips.admin.inc \beautytips_admin_submit()
Submit function for beautytips settings form
1 string reference to 'beautytips_admin_submit'
- beautytips_admin in ./
beautytips.admin.inc - Menu callback - beautytips admin settings form TODO: Add animation options.
File
- ./
beautytips.admin.inc, line 180 - Beautytips settings form and submit action
Code
function beautytips_admin_submit($form, &$form_state) {
$values = $form_state['values'];
if (count($values)) {
$custom_style = array();
$css_style = array();
foreach ($values as $option => $value) {
if (strpos($option, 'bt-options-box-') === 0) {
$option = str_replace('bt-options-box-', '', $option);
$custom_style[$option] = $value;
}
else {
if ($option == 'bt-options-cssClass') {
$option = str_replace('bt-options-', '', $option);
$custom_style[$option] = $value;
}
else {
if (strpos($option, 'bt-options-css-') === 0) {
$option = str_replace('bt-options-css-', '', $option);
if ($value) {
$css_style[$option] = $value;
}
}
}
}
}
// Store the defaults - they will be passed to javascript
$style = beautytips_get_style($values['beautytips_default_style']);
if (count($custom_style)) {
foreach ($custom_style as $option => $value) {
if ($option == 'shadow') {
if ($value != 'default') {
$style['shadow'] = $value == 'shadow' ? TRUE : FALSE;
}
}
else {
if (!empty($value) || $value == '0') {
$style[$option] = is_numeric($value) ? (int) $value : (string) $value;
}
}
}
}
if (count($css_style)) {
foreach ($css_style as $option => $value) {
if (!empty($value)) {
$style['cssStyles'][$option] = (string) $value;
}
}
if (!empty($css_style)) {
$custom_style['cssStyles'] = $css_style;
}
}
variable_set('beautytips_defaults', $style);
variable_set('beautytips_custom_style', $custom_style);
variable_set('beautytips_default_style', $values['beautytips_default_style']);
cache_clear_all('beautytips:beautytips-styles', 'cache');
}
if (module_exists('beautytips_addons')) {
beautytips_addons_admin_submit($form, $form_state);
}
}