help.module 4.07 KB
Newer Older
Dries's avatar
 
Dries committed
1
<?php
2
// $Id$
Dries's avatar
 
Dries committed
3

Dries's avatar
 
Dries committed
4
/**
Dries's avatar
 
Dries committed
5
 * Implementation of hook_menu().
Dries's avatar
 
Dries committed
6
 */
Dries's avatar
 
Dries committed
7 8 9
function help_menu() {
  $items = array();
  $items[] = array('path' => 'admin/help', 'title' => t('help'),
Dries's avatar
 
Dries committed
10
    'callback' => 'help_main',
Dries's avatar
 
Dries committed
11 12
    'access' => user_access('access administration pages'),
    'weight' => 9);
Dries's avatar
 
Dries committed
13 14 15 16 17 18 19 20 21 22 23
  
  foreach (module_list() as $name) {
    if (module_hook($name, 'help')) {
      if (module_invoke($name, 'help', "admin/help#$name")) {
        $items[] = array('path' => 'admin/help/' . $name,
          'title' => t($name),
          'callback' => 'help_page',
          'access' => user_access('access administration pages'));
      }
    }
  }
Dries's avatar
 
Dries committed
24
  return $items;
Dries's avatar
 
Dries committed
25 26
}

Dries's avatar
Dries committed
27 28 29
/**
 * Menu callback; prints a page listing a glossary of Drupal terminology.
 */
Dries's avatar
 
Dries committed
30
function help_main() {
Dries's avatar
Dries committed
31
  $output = t("
Dries's avatar
 
Dries committed
32 33 34 35 36 37
  <p>This guide explains what the various modules in <a href=\"%Drupal\">Drupal</a> do and how to configure them.</p>
  <p>It is not a substitute for the <a href=\"%handbook\">Drupal handbook</a> available online and should be used in conjunction with it. The online reference handbook might be more up-to-date and has helpful user-contributed comments. It is your definitive reference point for all Drupal documentation.</p>
  <h2>Help topics</h2>
  <p>Help is available on the following items:</p>
  %help_pages
  <h2>Glossary of Drupal Terminology</h2><dl>
Dries's avatar
 
Dries committed
38 39 40 41 42 43 44 45 46 47 48 49 50 51
  <dt>Block</dt><dd>A small box containing information or content placed in the left-hand or right-hand sidebar of a web page.</dd>
  <dt>Comment</dt><dd>A note attached to a node. Usually intended to clarify, explain, criticize, or express an opinion on the original material.</dd>
  <dt>Moderation</dt><dd>The activity of making sure a post to a Drupal site fits in with what is expected for that Drupal site.<dl>
  <dt>Approved</dt><dd>A moderated post which has been accepted by the moderators for publication. (See published).</dd>
  <dt>Waiting</dt><dd>A moderated post which is still being voted on to be accepted for publication. (See published.)</dd>
  <dt>Moderators</dt><dd>The group of Drupal users that reviews posts before they are published. These users have the \"access submission queue\" permission. (See Published).</dd></dl></dd>
  <dt>Node</dt><dd>The basic data unit in Drupal. Everything is a node or an extention of a node.</dd>
  <dt>Public</dt><dd>See published.</dd>
  <dt>Published</dt><dd>A node that is viewable by everyone. (See unpublished.)</dd>
  <dt>Role</dt><dd>A classification users are placed into for the purpose of setting users' permissions.</dd>
  <dt>Taxonomy</dt><dd>A division of a collection of things into ordered, classified groups. (See <a href=\"%taxonomy\">taxonomy help</a>.)</dd>
  <dt>Unpublished</dt><dd>A node that is only viewable by administrators and moderators.</dd>
  <dt>User</dt><dd>A person who has an account at your Drupal site, and is logged in with that account.</dd>
  <dt>Visitor</dt><dd>A person who does not have an account at your Drupal site or a person who has an account at your Drupal site but is <u>not</u> logged in with that account. Also termed \"anonymous user\".</dd>
Dries's avatar
 
Dries committed
52
  </dl>", array('%Drupal' => 'http://drupal.org', '%handbook' => 'http://drupal.org/handbook', '%help_pages' => help_links_as_list(), '%taxonomy' => url('admin/taxonomy/help')));
Dries's avatar
 
Dries committed
53

Dries's avatar
Dries committed
54
  print theme('page', $output);
Dries's avatar
 
Dries committed
55 56
}

Dries's avatar
 
Dries committed
57 58 59 60 61 62 63 64 65 66 67 68 69
function help_links_as_list() {
  $output = '<ul>';
  foreach (module_list() as $name) {
    if (module_hook($name, 'help')) {
      if (module_invoke($name, 'help', "admin/help#$name")) {
        $output .= '<li>' . t("<a href=\"%url\">$name</a>", array('%url' => url("admin/help/$name"))) . '</li>';
      }
    }
  }
  $output .= '</ul>';
  return $output;
}

Dries's avatar
Dries committed
70 71 72 73
/**
 * Implementation of hook_help().
 */
function help_help($section) {
Dries's avatar
 
Dries committed
74
  switch ($section) {
Dries's avatar
 
Dries committed
75
    case 'admin/modules#description':
Dries's avatar
 
Dries committed
76
      return t('Manages displaying online help.');
Dries's avatar
 
Dries committed
77
  }
Dries's avatar
 
Dries committed
78
}
Dries's avatar
 
Dries committed
79

Dries's avatar
Dries committed
80 81 82 83
/**
 * Menu callback; prints a page listing general help for all modules.
 */
function help_page() {
Dries's avatar
 
Dries committed
84 85 86 87 88
  $name = arg(2);
  if (module_hook($name, 'help')) {
    $temp = module_invoke($name, 'help', "admin/help#$name");
    if (!empty($temp)) {
      $output .= $temp;
Dries's avatar
Dries committed
89 90 91
    }
  }
  print theme('page', $output);
Dries's avatar
 
Dries committed
92 93
}

Dries's avatar
 
Dries committed
94
?>