You are here

function theme_advanced_help_topic in Advanced Help 5

Same name and namespace in other branches
  1. 6 advanced_help.module \theme_advanced_help_topic()
  2. 7 advanced_help.module \theme_advanced_help_topic()

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 theme call to theme_advanced_help_topic()
help_example_index_page in help_example/help_example.module

File

./advanced_help.module, line 397
advanced_help.module

Code

function theme_advanced_help_topic($module, $topic, $type = 'icon') {
  $info = advanced_help_get_topic($module, $topic);
  if (!$info) {
    return;
  }
  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(
      'class' => $class,
      'onclick' => "window.open(this.href, 'advanced_help_window', 'width=500,height=500,scrollbars,resizable'); return false;",
      'title' => $info['title'],
    ), 'popup=TRUE', NULL, FALSE, TRUE);
  }
  else {
    return l($text, "help/{$module}/{$topic}", array(
      'class' => $class,
      'title' => $info['title'],
    ), NULL, NULL, FALSE, TRUE);
  }
}