You are here

function theme_beautytips_advanced_help_topic in BeautyTips 6

Same name and namespace in other branches
  1. 8 includes/drupal_help.inc \theme_beautytips_advanced_help_topic()
  2. 6.2 includes/drupal_help.inc \theme_beautytips_advanced_help_topic()
  3. 7.2 includes/drupal_help.inc \theme_beautytips_advanced_help_topic()

Override of theme_advanced_help_topic to add Beautytips Display a help icon with a link to view the topic in a popup.

Parameters

$module: The module that owns this help topic.

$topic: The identifier for the topic

$type:

  • 'icon' to display the question mark icon
  • 'title' to display the topic's title
  • any other text to display the text. Be sure to t() it!
1 string reference to 'theme_beautytips_advanced_help_topic'
beautytips_theme_registry_alter in ./beautytips.module
Implementation of hook_theme_registry_alter

File

./beautytips.module, line 407
Provides API for adding beautytips to pages. Adds Beautytips settings page and provides some built in functionality.

Code

function theme_beautytips_advanced_help_topic($module, $topic, $type = 'icon') {
  $info = advanced_help_get_topic($module, $topic);
  if (!$info) {
    return;
  }

  // Add bt to advanced-help links
  $options['bt_advanced_help'] = array(
    'area' => 'a.advanced-help-link',
    'ajaxPath' => array(
      0 => "\$(this).attr('href')",
      1 => '#content-content:not(#content-content.help-navigation)',
    ),
    'trigger' => array(
      0 => 'mouseover',
      1 => 'click',
    ),
    'width' => 380,
  );
  beautytips_add_beautytips($options);
  switch ($type) {
    case 'icon':
      $text = '<span>' . t('Help') . '</span>';
      $class = 'advanced-help-link';
      break;
    case 'title':
      $text = $info['title'];
      $class = 'advanced-help-title';
      break;
    default:
      $class = 'advanced-help-title';
      $text = $type;
      break;
  }
  if (user_access('view advanced help popup')) {
    drupal_add_css(drupal_get_path('module', 'advanced_help') . '/help-icon.css');
    return l($text, "help/{$module}/{$topic}", array(
      'attributes' => array(
        'class' => $class,
        'onclick' => "var w=window.open(this.href, 'advanced_help_window', 'width=" . $info['popup width'] . ",height=" . $info['popup height'] . ",scrollbars,resizable'); w.focus(); return false;",
        'title' => $info['title'],
      ),
      'query' => array(
        'popup' => TRUE,
      ),
      'html' => TRUE,
    ));
  }
  else {
    return l($text, "help/{$module}/{$topic}", array(
      'attributes' => array(
        'class' => $class,
        'title' => $info['title'],
      ),
      'html' => TRUE,
    ));
  }
}