/[drupal]/drupal/modules/help/help.admin.inc
ViewVC logotype

Contents of /drupal/modules/help/help.admin.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.11 - (show annotations) (download) (as text)
Tue Oct 13 05:26:57 2009 UTC (6 weeks, 3 days ago) by webchick
Branch: MAIN
CVS Tags: DRUPAL-7-0-UNSTABLE-10, HEAD
Changes since 1.10: +2 -2 lines
File MIME type: text/x-php
#561452 by pwolanin and David_Rothstein: Add API function to get module/theme info without rebuilding it.
1 <?php
2 // $Id: help.admin.inc,v 1.10 2009/10/09 00:59:59 dries Exp $
3
4 /**
5 * @file
6 * Admin page callbacks for the help module.
7 */
8
9 /**
10 * Menu callback; prints a page listing a glossary of Drupal terminology.
11 */
12 function help_main() {
13 // Add CSS
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 * Menu callback; prints a page listing general help for a module.
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 else {
33 $output .= $temp;
34 }
35
36 // Only print list of administration pages if the module in question has
37 // any such pages associated to it.
38 $admin_tasks = system_get_module_admin_tasks($name);
39 if (!empty($admin_tasks)) {
40 ksort($admin_tasks);
41 $output .= theme('item_list', array('items' => $admin_tasks, 'title' => 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_rebuild_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 // Output pretty four-column list
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

  ViewVC Help
Powered by ViewVC 1.1.2