| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
function help_main() {
|
| 13 |
|
| 14 |
drupal_add_css(drupal_get_path('module', 'help') . '/help.css', array('preprocess' => FALSE));
|
| 15 |
$output = '<h2>' . t('Help topics') . '</h2><p>' . t('Help is available on the following items:') . '</p>' . help_links_as_list();
|
| 16 |
return $output;
|
| 17 |
}
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
function help_page($name) {
|
| 23 |
$output = '';
|
| 24 |
if (module_hook($name, 'help')) {
|
| 25 |
$module = drupal_parse_info_file(drupal_get_path('module', $name) . '/' . $name . '.info');
|
| 26 |
drupal_set_title($module['name']);
|
| 27 |
|
| 28 |
$temp = module_invoke($name, 'help', "admin/help#$name", drupal_help_arg());
|
| 29 |
if (empty($temp)) {
|
| 30 |
$output .= t("No help is available for module %module.", array('%module' => $module['name']));
|
| 31 |
}
|
| 32 |
|
| 33 |
$output .= $temp;
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
$admin_tasks = system_get_module_admin_tasks($name);
|
| 39 |
if (!empty($admin_tasks)) {
|
| 40 |
ksort($admin_tasks);
|
| 41 |
$output .= theme('item_list', $admin_tasks, t('@module administration pages', array('@module' => $module['name'])));
|
| 42 |
}
|
| 43 |
|
| 44 |
}
|
| 45 |
return $output;
|
| 46 |
}
|
| 47 |
|
| 48 |
function help_links_as_list() {
|
| 49 |
$empty_arg = drupal_help_arg();
|
| 50 |
$module_info = system_get_module_data();
|
| 51 |
|
| 52 |
$modules = array();
|
| 53 |
foreach (module_implements('help', TRUE) as $module) {
|
| 54 |
if (module_invoke($module, 'help', "admin/help#$module", $empty_arg)) {
|
| 55 |
$modules[$module] = $module_info[$module]->info['name'];
|
| 56 |
}
|
| 57 |
}
|
| 58 |
asort($modules);
|
| 59 |
|
| 60 |
|
| 61 |
$count = count($modules);
|
| 62 |
$break = ceil($count / 4);
|
| 63 |
$output = '<div class="clearfix"><div class="help-items"><ul>';
|
| 64 |
$i = 0;
|
| 65 |
foreach ($modules as $module => $name) {
|
| 66 |
$output .= '<li>' . l($name, 'admin/help/' . $module) . '</li>';
|
| 67 |
if (($i + 1) % $break == 0 && ($i + 1) != $count) {
|
| 68 |
$output .= '</ul></div><div class="help-items' . ($i + 1 == $break * 3 ? ' help-items-last' : '') . '"><ul>';
|
| 69 |
}
|
| 70 |
$i++;
|
| 71 |
}
|
| 72 |
$output .= '</ul></div></div>';
|
| 73 |
|
| 74 |
return $output;
|
| 75 |
}
|
| 76 |
|
| 77 |
|