View source
<?php
function beautytips_drupal_help_admin_info() {
$form['beautytips_help'] = array(
'#type' => 'fieldset',
'#title' => 'Help Link Tooltips',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['beautytips_help']['beautytips_drupal_help'] = array(
'#type' => 'checkbox',
'#title' => 'Display Help link popups',
'#default_value' => variable_get('beautytips_drupal_help', FALSE),
);
if (module_exists('advanced_help')) {
$form['beautytips_help']['beautytips_advanced_help'] = array(
'#type' => 'checkbox',
'#title' => 'Display Advanced Help link popups',
'#default_value' => variable_get('beautytips_advanced_help', FALSE),
);
}
return $form;
}
function beautytips_drupal_help_menu_change(&$items) {
if (variable_get('beautytips_drupal_help', FALSE)) {
$items['admin/help']['page callback'] = 'beautytips_drupal_help_main';
$items['admin/help']['file path'] = drupal_get_path('module', 'beautytips') . '/includes';
$items['admin/help']['file'] = 'drupal_help.inc';
}
}
function beautytips_drupal_help_main() {
$options['bt_drupal_help_page'] = array(
'cssSelect' => '.help-items li a',
'ajaxPath' => array(
"\$(this).attr('href')",
'.clear-block p',
),
'trigger' => array(
0 => 'mouseover',
1 => 'click',
),
'width' => 350,
);
beautytips_add_beautytips($options);
require_once drupal_get_path('module', 'help') . '/help.admin.inc';
$help_path = drupal_get_path('module', 'help');
drupal_add_css($help_path . '/help.css', 'module', 'all', FALSE);
$output = '<h2>' . t('Help topics') . '</h2><p>' . t('Help is available on the following items:') . '</p>' . help_links_as_list();
return $output;
}
function beautytips_drupal_help_theme_change(&$theme_registry) {
if (module_exists('help') && variable_get('beautytips_drupal_help', FALSE)) {
$theme_registry['more_help_link']['function'] = 'theme_beautytips_drupal_help_more_help_link';
$theme_registry['more_help_link']['file'] = drupal_get_path('module', 'beautytips') . '/includes/drupal_help.inc';
}
if (module_exists('advanced_help') && variable_get('beautytips_advanced_help', FALSE)) {
$theme_registry['advanced_help_topic']['function'] = 'theme_beautytips_advanced_help_topic';
$theme_registry['advanced_help_topic']['file'] = drupal_get_path('module', 'beautytips') . '/includes/drupal_help.inc';
}
}
function theme_beautytips_drupal_help_more_help_link($url) {
$options = array();
$options['bt_drupal_help'] = array(
'cssSelect' => '.more-help-link a',
'ajaxPath' => array(
0 => "\$(this).attr('href')",
1 => '.clear-block p',
),
'trigger' => array(
0 => 'mouseover',
1 => 'click',
),
'width' => 350,
);
beautytips_add_beautytips($options);
return theme_more_help_link($url);
}
function theme_beautytips_advanced_help_topic($module, $topic, $type = 'icon') {
$options['bt_advanced_help'] = array(
'cssSelect' => 'a.advanced-help-link',
'ajaxPath' => array(
"\$(this).attr('href')",
'#content-content',
),
'trigger' => array(
0 => 'mouseover',
1 => 'click',
),
'width' => 380,
);
beautytips_add_beautytips($options);
return theme_advanced_help_topic($module, $topic, $type);
}