function theme_advanced_help_topic in Advanced Help 6
Same name and namespace in other branches
- 5 advanced_help.module \theme_advanced_help_topic()
- 7 advanced_help.module \theme_advanced_help_topic()
Display a help icon with a link to view the topic in a popup.
Parameters
string $module: The module that owns this help topic.
string $topic: The identifier for the topic
string $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 - Topic index callback.
File
- ./
advanced_help.module, line 451 - Pluggable system to provide advanced help facilities for Drupal and modules.
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(
'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,
));
}
elseif (user_access('view advanced help topic')) {
return l($text, "help/{$module}/{$topic}", array(
'attributes' => array(
'class' => $class,
'title' => $info['title'],
),
'html' => TRUE,
));
}
}