function beautytips_manager_init in BeautyTips 7.2
Same name and namespace in other branches
- 6.2 beautytips_manager.module \beautytips_manager_init()
Implements hook_init().
File
- ./
beautytips_manager.module, line 80 - Code related to defining and displaying custom beautytips and styles.
Code
function beautytips_manager_init() {
$options = [];
$tips = beautytips_manager_get_custom_tips();
if (count($tips)) {
foreach ($tips as $tip) {
if (!$tip->enabled) {
continue;
}
// Match path if necessary
if ($tip->pages) {
$path = drupal_get_path_alias($_GET['q']);
// Compare with the internal and path alias (if any).
$page_match = drupal_match_path($path, $tip->pages);
if ($path != $_GET['q']) {
$page_match = $page_match || drupal_match_path($_GET['q'], $tip->pages);
}
// When $tip->visibility has a value of 0, the beautytip is displayed on
// all pages except those listed in $tip->pages. When set to 1, it
// is displayed only on those pages listed in $tip->pages.
$page_match = !($tip->visibility xor $page_match);
}
else {
if (!$tip->visibility) {
$page_match = TRUE;
}
else {
$page_match = FALSE;
}
}
if ($page_match) {
$options['beautytips_manager_custom_' . $tip->id] = beautytips_manager_build_beautytip($tip);
}
}
}
if (count($options)) {
beautytips_add_beautytips($options);
}
}