function beautytips_manager_define_beautytips_styles in BeautyTips 7.2
Same name and namespace in other branches
- 8 beautytips_manager/beautytips_manager.module \beautytips_manager_define_beautytips_styles()
Implements hook_define_beautytips_styles().
File
- ./
beautytips_manager.module, line 338 - Code related to defining and displaying custom beautytips and styles.
Code
function beautytips_manager_define_beautytips_styles() {
$styles = [];
$custom_styles = beautytips_manager_get_custom_styles();
$style_map = beautytips_manager_style_mapping();
$style_options = array_flip($style_map['options']);
$css_style_options = array_flip($style_map['css_options']);
if (count($custom_styles)) {
foreach ($custom_styles as $id => $style) {
$options = [];
foreach ($style as $key => $value) {
if (isset($style_options[$key])) {
if ($key == 'shadow') {
if ($value != 'default') {
$options['shadow'] = $value == 'shadow' ? TRUE : FALSE;
}
}
else {
if (!is_null($value) && $value != '') {
// Add the setting and make sure integers stay as integers.
$options[$style_options[$key]] = ctype_digit($value) || is_int($value) ? (int) $value : check_plain($value);
}
}
}
else {
if (isset($css_style_options[$key])) {
if (!is_null($value) && $value != '') {
$options['cssStyles'][$css_style_options[$key]] = check_plain($value);
}
}
}
}
$styles[$style->name] = $options;
}
}
return $styles;
}