1
|
<?php
|
2
|
/**
|
3
|
* @file
|
4
|
* Provide example help for the advanced help module.
|
5
|
*/
|
6
|
|
7
|
/**
|
8
|
* Implements hook_admin_paths_alter().
|
9
|
*
|
10
|
* Force help pages for this module to be rendered in admin theme.
|
11
|
*/
|
12
|
function help_example_admin_paths_alter(&$paths) {
|
13
|
$paths['help/help_example/*'] = TRUE;
|
14
|
}
|
15
|
|
16
|
/**
|
17
|
* Implements hook_menu().
|
18
|
*/
|
19
|
function help_example_menu() {
|
20
|
// View help topic index.
|
21
|
$items['admin/help_example'] = array(
|
22
|
'title' => 'Example help',
|
23
|
'page callback' => 'help_example_index_page',
|
24
|
'access arguments' => array('view advanced help index'),
|
25
|
'weight' => 9,
|
26
|
);
|
27
|
return $items;
|
28
|
}
|
29
|
|
30
|
/**
|
31
|
* Topic index callback.
|
32
|
*/
|
33
|
function help_example_index_page() {
|
34
|
$output = '<p>' . t('Read the source code of the module <strong>Help example</strong> to learn how to create themed and plain links to help topics, and how to render help in the adminstrative theme.') . '</p>';
|
35
|
$output .= '<p>' . t('Two popup examples:') . '<br />';
|
36
|
|
37
|
// Create the question mark icon for the topic.
|
38
|
$toc_qm = theme('advanced_help_topic', array(
|
39
|
'module' => 'help_example',
|
40
|
'topic' => 'toc',
|
41
|
'type' => 'icon',
|
42
|
));
|
43
|
// Append some explanatory text.
|
44
|
$output .= $toc_qm . ' ' . t('Click the help icon on the left to view a popup of the example module index page.');
|
45
|
|
46
|
$output .= '<br />';
|
47
|
$topic_qm = theme('advanced_help_topic', array(
|
48
|
'module' => 'help_example',
|
49
|
'topic' => 'about-example',
|
50
|
'type' => 'icon',
|
51
|
));
|
52
|
$output .= $topic_qm . ' ' . t('Click the help icon on the left to view a popup of the first help topic.');
|
53
|
|
54
|
// Create the question mark icon for the topic.
|
55
|
$toc_qm = theme('advanced_help_topic', array(
|
56
|
'module' => 'help_example',
|
57
|
'topic' => 'toc',
|
58
|
'type' => 'icon',
|
59
|
));
|
60
|
// Append some explanatory text.
|
61
|
|
62
|
$output .= '</p>';
|
63
|
|
64
|
$output .= '</p>';
|
65
|
$topic_title = theme('advanced_help_topic', array(
|
66
|
'module' => 'help_example',
|
67
|
'topic' => 'lorem',
|
68
|
'type' => 'title',
|
69
|
));
|
70
|
$output .= t('Link to a popup of the topic with the title: ') . $topic_title . '.';
|
71
|
$output .= '</p>';
|
72
|
|
73
|
$output .= '</p>';
|
74
|
$topic_title = theme('advanced_help_topic', array(
|
75
|
'module' => 'help_example',
|
76
|
'topic' => 'etiam',
|
77
|
'type' => 'anchor text',
|
78
|
));
|
79
|
$output .= t('Link to a popup of the third topic with user defined ') . $topic_title . '.';
|
80
|
$output .= '</p>';
|
81
|
|
82
|
|
83
|
$output .= '<p>' . t('Examples of unthemed links to help pages:') . '<br />';
|
84
|
$output .= t('Link to <a href="@url">the example module index page</a>.<br />', array('@url' => '/admin/help/ah/help_example'));
|
85
|
$output .= t('Link to the <a href="@url">first help topic</a>.', array('@url' => '/help/help_example/about-example'));
|
86
|
|
87
|
$output .= '</p>';
|
88
|
|
89
|
return $output;
|
90
|
}
|