| 10 |
* Menu callback; prints a page displaying available help topics for modules. |
* Menu callback; prints a page displaying available help topics for modules. |
| 11 |
*/ |
*/ |
| 12 |
function help_index_page() { |
function help_index_page() { |
| 13 |
|
if (!empty($_GET['popup'])) { |
| 14 |
|
print help_by_module(); |
| 15 |
|
return; |
| 16 |
|
} |
| 17 |
|
else { |
| 18 |
|
return help_topic_page('help', 'welcome-page', FALSE); |
| 19 |
|
} |
| 20 |
|
} |
| 21 |
|
|
| 22 |
|
/** |
| 23 |
|
* Menu callback; prints a page displaying available help topics for modules. |
| 24 |
|
*/ |
| 25 |
|
function help_by_module() { |
| 26 |
$output = ''; |
$output = ''; |
| 27 |
$breadcrumb = array(); |
$breadcrumb = array(); |
| 28 |
$menu_items = array(); |
$menu_items = array(); |
| 34 |
$modules = module_rebuild_cache(); |
$modules = module_rebuild_cache(); |
| 35 |
foreach ($modules as $file) { |
foreach ($modules as $file) { |
| 36 |
$module = $file->name; |
$module = $file->name; |
| 37 |
if (empty($topics[$module])) { |
if (empty($topics[$module]) || $module == 'help') { |
| 38 |
continue; |
continue; |
| 39 |
} |
} |
| 40 |
|
|
| 68 |
/** |
/** |
| 69 |
* Menu callback; prints a page with help topic for a module. |
* Menu callback; prints a page with help topic for a module. |
| 70 |
*/ |
*/ |
| 71 |
function help_topic_page($module, $topic = NULL) { |
function help_topic_page($module, $topic = NULL, $bells_and_whistles = TRUE) { |
| 72 |
$info = help_get_topic($module, $topic); |
$info = help_get_topic($module, $topic); |
| 73 |
if (isset($topic) && !$info) { |
if (isset($topic) && !$info) { |
| 74 |
return drupal_not_found(); |
return drupal_not_found(); |
| 110 |
$breadcrumb[] = help_l(help_get_module_name($pmodule), "admin/help/$pmodule"); |
$breadcrumb[] = help_l(help_get_module_name($pmodule), "admin/help/$pmodule"); |
| 111 |
$breadcrumb[] = help_l(t('Help'), "admin/help"); |
$breadcrumb[] = help_l(t('Help'), "admin/help"); |
| 112 |
|
|
| 113 |
if (isset($topic)) { |
if (!isset($topic)) { |
| 114 |
$output = help_view_topic($module, $topic, $popup); |
$topic = 'about'; |
|
} |
|
|
else { |
|
|
$output = help_view_topic($module, 'about', $popup); |
|
| 115 |
drupal_set_title(t('About @module', array('@module' => help_get_module_name($module)))); |
drupal_set_title(t('About @module', array('@module' => help_get_module_name($module)))); |
| 116 |
} |
} |
| 117 |
|
$output = help_view_topic($module, $topic, $popup, $bells_and_whistles); |
| 118 |
if (empty($output)) { |
if (empty($output)) { |
| 119 |
$output = t('Missing help topic.'); |
if ($topic == 'about') { |
| 120 |
|
$output = help_view_module($module, $popup); |
| 121 |
|
} |
| 122 |
|
else { |
| 123 |
|
$output = t('Missing help topic.'); |
| 124 |
|
} |
| 125 |
} |
} |
| 126 |
|
|
| 127 |
if ($popup) { |
if ($popup) { |
| 130 |
print theme('help_popup', $output); |
print theme('help_popup', $output); |
| 131 |
return; |
return; |
| 132 |
} |
} |
| 133 |
|
|
| 134 |
$breadcrumb[] = help_l('Administer', 'admin'); |
if ($bells_and_whistles) { |
| 135 |
$breadcrumb[] = l('Home', ''); |
$breadcrumb[] = help_l('Administer', 'admin'); |
| 136 |
drupal_set_breadcrumb(array_reverse($breadcrumb)); |
$breadcrumb[] = l('Home', ''); |
| 137 |
|
drupal_set_breadcrumb(array_reverse($breadcrumb)); |
| 138 |
|
} |
| 139 |
drupal_add_css(drupal_get_path('module', 'help') . '/help.css'); |
drupal_add_css(drupal_get_path('module', 'help') . '/help.css'); |
| 140 |
return $output; |
return $output; |
| 141 |
} |
} |
| 158 |
/** |
/** |
| 159 |
* Load and render a help topic. |
* Load and render a help topic. |
| 160 |
*/ |
*/ |
| 161 |
function help_view_topic($module, $topic, $popup = FALSE) { |
function help_view_topic($module, $topic, $popup = FALSE, $bells_and_whistles = TRUE) { |
| 162 |
$file = help_get_topic_filename($module, $topic); |
$file = help_get_topic_filename($module, $topic); |
| 163 |
$info = help_get_topic($module, $topic); |
$info = help_get_topic($module, $topic); |
| 164 |
if ($file) { |
if ($file) { |
| 195 |
$output = preg_replace('/href="base_url:([^"]+)"/', 'href="' . strtr(url('$1'), array('%24' => '$')) . '"', $output); |
$output = preg_replace('/href="base_url:([^"]+)"/', 'href="' . strtr(url('$1'), array('%24' => '$')) . '"', $output); |
| 196 |
$output = preg_replace('/src="base_url:([^"]+)"/', 'src="' . strtr(url('$1'), array('%24' => '$')) . '"', $output); |
$output = preg_replace('/src="base_url:([^"]+)"/', 'src="' . strtr(url('$1'), array('%24' => '$')) . '"', $output); |
| 197 |
|
|
| 198 |
if (!empty($info['navigation'])) { |
if (!empty($info['navigation']) && !empty($bells_and_whistles)) { |
| 199 |
$topics = help_get_topics(); |
$topics = help_get_topics(); |
| 200 |
help_get_topic_hierarchy($topics); |
help_get_topic_hierarchy($topics); |
| 201 |
|
|