View source
<?php
function beautytips_drupal_help_admin_info() {
$form['beautytips_help'] = [
'#type' => 'fieldset',
'#title' => 'Help Link Tooltips',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
];
$form['beautytips_help']['beautytips_drupal_help'] = [
'#type' => 'checkbox',
'#title' => 'Display Help link popups',
'#default_value' => \Drupal::state()
->get('beautytips_drupal_help', FALSE),
];
if (\Drupal::moduleHandler()
->moduleExists('advanced_help')) {
$form['beautytips_help']['beautytips_advanced_help'] = [
'#type' => 'checkbox',
'#title' => 'Display Advanced Help link popups',
'#default_value' => \Drupal::state()
->get('beautytips_advanced_help', FALSE),
];
}
return $form;
}
function beautytips_drupal_help_menu_change(&$items) {
if (\Drupal::state()
->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() {
require_once drupal_get_path('module', 'help') . '/help.admin.inc';
$options['bt_drupal_help_page'] = [
'cssSelect' => '.help-items li a',
'ajaxPath' => [
"\$(this).attr('href')",
'.content',
],
'trigger' => [
'mouseover',
'click',
],
'width' => 350,
];
beautytips_add_beautytips($options);
return help_main();
}
function beautytips_drupal_help_theme_change(&$theme_registry) {
if (\Drupal::moduleHandler()
->moduleExists('help') && \Drupal::state()
->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 (\Drupal::moduleHandler()
->moduleExists('advanced_help') && \Drupal::state()
->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($variables) {
$options = [];
$options['bt_drupal_help'] = [
'cssSelect' => '.more-help-link a',
'ajaxPath' => [
"\$(this).attr('href')",
'#content',
],
'trigger' => [
0 => 'mouseover',
1 => 'click',
],
'width' => 600,
];
beautytips_add_beautytips($options);
return theme_more_help_link($variables);
}
function theme_beautytips_advanced_help_topic(&$variables) {
$options['bt_advanced_help'] = [
'cssSelect' => 'a.advanced-help-link',
'ajaxPath' => [
"\$(this).attr('href')",
'#content-content:not(#content-content.help-navigation)',
],
'trigger' => [
'mouseover',
'click',
],
'width' => 380,
];
beautytips_add_beautytips($options);
return theme_advanced_help_topic($variables);
}