Commit 9e6ef53c authored by Gábor Hojtsy's avatar Gábor Hojtsy

#154064 by pwolanin: get hook_help() up to speed to menu changes, allowing...

#154064 by pwolanin: get hook_help() up to speed to menu changes, allowing router path based lookups, and also full path argument lookup with a passed argument array
parent 0995d62b
......@@ -837,31 +837,33 @@ function theme_menu_local_task($link, $active = FALSE) {
return '<li '. ($active ? 'class="active" ' : '') .'>'. $link .'</li>';
}
/**
* Generates elements for the $arg array in the help hook.
*/
function drupal_help_arg($arg = array()) {
// Note - the number of empty elements should be > MENU_MAX_PARTS.
return $arg + array('', '', '', '', '', '', '', '', '', '', '', '');
}
/**
* Returns the help associated with the active menu item.
*/
function menu_get_active_help() {
$output = '';
$item = menu_get_item();
$router_path = menu_tab_root_path();
if (!$item || !$item['access']) {
// Don't return help text for areas the user cannot access.
return;
}
$path = ($item['type'] == MENU_DEFAULT_LOCAL_TASK) ? $item['tab_parent'] : $item['path'];
$arg = drupal_help_arg(arg(NULL));
$empty_arg = drupal_help_arg();
foreach (module_list() as $name) {
if (module_hook($name, 'help')) {
if ($temp = module_invoke($name, 'help', $path)) {
$output .= $temp ."\n";
// Lookup help for this path.
if ($help = module_invoke($name, 'help', $router_path, $arg)) {
$output .= $help ."\n";
}
if (module_hook('help', 'page')) {
if (arg(0) == "admin") {
if (module_invoke($name, 'help', 'admin/help#'. arg(2)) && !empty($output)) {
$output .= theme("more_help_link", url('admin/help/'. arg(2)));
}
}
// Add "more help" link on admin pages if the module provides a standalone help page.
if (module_hook('help', 'page') && $arg[0] == "admin" && module_invoke($name, 'help', 'admin/help#'. $arg[2], $empty_arg) && $help) {
$output .= theme("more_help_link", url('admin/help/'. $arg[2]));
}
}
}
......@@ -913,11 +915,16 @@ function menu_secondary_links() {
*
* @param $level
* The level of tasks you ask for. Primary tasks are 0, secondary are 1.
* @param $return_root
* Whether to return the root path for the current page.
* @return
* Themed output corresponding to the tabs of the requested level.
* Themed output corresponding to the tabs of the requested level, or if
* router path if $root == TRUE. This router path will correspond to the
* a parent tab, if the current page is a default local task.
*/
function menu_local_tasks($level = 0) {
function menu_local_tasks($level = 0, $return_root = FALSE) {
static $tabs = array();
static $root_path;
if (empty($tabs)) {
$router_item = menu_get_item();
......@@ -929,6 +936,7 @@ function menu_local_tasks($level = 0) {
$map = arg();
$children = array();
$tasks = array();
$root_path = $router_item['path'];
while ($item = db_fetch_array($result)) {
_menu_translate($item, $map, TRUE);
......@@ -984,6 +992,9 @@ function menu_local_tasks($level = 0) {
// Find the first parent which is not a default local task.
for ($p = $item['tab_parent']; $tasks[$p]['type'] == MENU_DEFAULT_LOCAL_TASK; $p = $tasks[$p]['tab_parent']);
$link = l($item['title'], $tasks[$p]['href']);
if ($item['path'] == $router_item['path']) {
$root_path = $tasks[$p]['path'];
}
}
else {
$link = l($item['title'], $item['href']);
......@@ -1011,8 +1022,14 @@ function menu_local_tasks($level = 0) {
// Remove the depth, we are interested only in their relative placement.
$tabs = array_values($tabs);
}
// We do not display single tabs.
return (isset($tabs[$level]) && $tabs[$level]['count'] > 1) ? $tabs[$level]['output'] : '';
if ($return_root) {
return $root_path;
}
else {
// We do not display single tabs.
return (isset($tabs[$level]) && $tabs[$level]['count'] > 1) ? $tabs[$level]['output'] : '';
}
}
function menu_primary_local_tasks() {
......@@ -1024,8 +1041,14 @@ function menu_secondary_local_tasks() {
}
/**
* Returns the rendered local tasks. The default implementation renders
* them as tabs.
* Returns the router path, or the path of the parent tab of a default local task.
*/
function menu_tab_root_path() {
return menu_local_tasks(0, TRUE);
}
/**
* Returns the rendered local tasks. The default implementation renders them as tabs.
*
* @ingroup themeable
*/
......
......@@ -9,8 +9,8 @@
/**
* Implementation of hook_help().
*/
function aggregator_help($section) {
switch ($section) {
function aggregator_help($path, $arg) {
switch ($path) {
case 'admin/help#aggregator':
$output = '<p>'. t('The news aggregator is a powerful on-site RSS syndicator/news reader that can gather fresh content from news sites and weblogs around the web.') .'</p>';
$output .= '<p>'. t('Users can view the latest news chronologically in the <a href="@aggregator">main news aggregator display</a> or by <a href="@aggregator-sources">source</a>. Administrators can add, edit and delete feeds and choose how often to check for newly updated news for each individual feed. Administrators can also tag individual feeds with categories, offering selective grouping of some feeds into separate displays. Listings of the latest news for individual sources or categorized sources can be enabled as blocks for display in the sidebar through the <a href="@admin-block">block administration page</a>. The news aggregator requires cron to check for the latest news from the sites to which you have subscribed. Drupal also provides a <a href="@aggregator-opml">machine-readable OPML file</a> of all of your subscribed feeds.', array('@aggregator' => url('aggregator'), '@aggregator-sources' => url('aggregator/sources'), '@admin-block' => url('admin/build/block'), '@aggregator-opml' => url('aggregator/opml'))) .'</p>';
......
......@@ -15,8 +15,8 @@
/**
* Implementation of hook_help().
*/
function block_help($section) {
switch ($section) {
function block_help($path, $arg) {
switch ($path) {
case 'admin/help#block':
$output = '<p>'. t('Blocks are boxes of content that may be rendered into certain regions of your web pages, for example, into sidebars. Blocks are usually generated automatically by modules (e.g., Recent Forum Topics), but administrators can also define custom blocks.') .'</p>';
$output .= '<p>'. t('The region each block appears in depends on both which theme you are using (some themes allow greater control over block placement than others), and on the settings in the block administration section.') .'</p>';
......
......@@ -60,8 +60,8 @@ function blog_user($type, &$edit, &$user) {
/**
* Implementation of hook_help().
*/
function blog_help($section) {
switch ($section) {
function blog_help($path, $arg) {
switch ($path) {
case 'admin/help#blog':
$output = '<p>'. t('The blog module allows registered users to maintain an online weblog (commonly known as a blog), often referred to as an online journal or diary. Blogs are made up of individual posts that are time stamped and are typically viewed by date as you would a diary. Blogs often contain links to web pages users have read and/or agree/disagree with.') .'</p>';
$output .= '<p>'. t('The blog module adds a <em>user blogs</em> navigation link to the site, which takes any visitor to a page that displays the most recent blog entries from all the users on the site. The navigation menu has a <em>create a blog entry</em> link (which takes you to a submission form) and a <em>view personal blog</em> link (which displays your blog entries as other people will see them). The blog module also creates a <em>recent blog posts</em> block that can be enabled.') .'</p>';
......
......@@ -9,8 +9,8 @@
/**
* Implementation of hook_help().
*/
function blogapi_help($section) {
switch ($section) {
function blogapi_help($path, $arg) {
switch ($path) {
case 'admin/help#blogapi':
$output = '<p>'. t('The blog API module enables a post to be posted to a site via external GUI applications. Many users prefer to use external tools to improve their ability to read and post responses in a customized way. The blog api provides users the freedom to use the blogging tools they want but still have the blogging server of choice.') .'</p>';
$output .= '<p>'. t('When this module is enabled and configured you can use programs like <a href="@external-http-ecto-kung-foo-tv">Ecto</a> to create and publish posts from your desktop. Blog API module supports several XML-RPC based blogging APIs such as the <a href="@-">Blogger API</a>, <a href="@external-http-www-xmlrpc-com-metaWeblogApi">MetaWeblog API</a>, and most of the <a href="@external-http-www-movabletype-org-docs-mtmanual_programmatic-html">Movable Type API</a>. Any desktop blogging tools or other services (e.g. <a href="@external-http-www-flickr-com">Flickr\'s</a> "post to blog") that support these APIs should work with this site.', array('@external-http-ecto-kung-foo-tv' => 'http://ecto.kung-foo.tv/', '@-' => url('http://www.blogger.com/developers/api/1_docs/'), '@external-http-www-xmlrpc-com-metaWeblogApi' => 'http://www.xmlrpc.com/metaWeblogApi', '@external-http-www-movabletype-org-docs-mtmanual_programmatic-html' => 'http://www.movabletype.org/docs/mtmanual_programmatic.html', '@external-http-www-flickr-com' => 'http://www.flickr.com')) .'</p>';
......
......@@ -990,8 +990,8 @@ function book_admin_overview() {
/**
* Implementation of hook_help().
*/
function book_help($section) {
switch ($section) {
function book_help($path, $arg) {
switch ($path) {
case 'admin/help#book':
$output = '<p>'. t('The <em>book</em> module is suited for creating structured, multi-page hypertexts such as site resource guides, manuals, and Frequently Asked Questions (FAQs). It permits a document to have chapters, sections, subsections, etc. Authors with suitable permissions can add pages to a collaborative book, placing them into the existing document by adding them to a table of contents menu.') .'</p>';
$output .= '<p>'. t('Book pages have navigation elements at the bottom of the page for moving through the text. These link to the previous and next pages in the book, as well as a link labeled <em>up</em>, leading to the level above in the structure. More comprehensive navigation may be provided by enabling the <em>book navigation block</em> on the <a href="@admin-block">block administration page</a>.', array('@admin-block' => url('admin/build/block'))) .'</p>';
......@@ -1004,9 +1004,7 @@ function book_help($section) {
return '<p>'. t('The book module offers a means to organize content, authored by many users, in an online manual, outline or FAQ.') .'</p>';
case 'admin/content/book/orphan':
return '<p>'. t('Pages in a book are like a tree. As pages are edited, reorganized and removed, child pages might be left with no link to the rest of the book. Such pages are referred to as "orphan pages". On this page, administrators can review their books for orphans and reattach those pages as desired.') .'</p>';
}
if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == 'outline') {
return '<p>'. t('The outline feature allows you to include posts in the <a href="@book">book hierarchy</a>.', array('@book' => url('book'))) .'</p>';
case 'node/%/outline':
return '<p>'. t('The outline feature allows you to include posts in the <a href="@book">book hierarchy</a>.', array('@book' => url('book'))) .'</p>';
}
}
......@@ -123,17 +123,16 @@
/**
* Implementation of hook_help().
*/
function comment_help($section) {
switch ($section) {
function comment_help($path, $arg) {
switch ($path) {
case 'admin/help#comment':
$output = '<p>'. t('The comment module creates a discussion board for each post. Users can post comments to discuss a forum topic, weblog post, story, collaborative book page, etc. The ability to comment is an important part of involving members in a community dialogue.') .'</p>';
$output .= '<p>'. t('An administrator can give comment permissions to user groups, and users can (optionally) edit their last comment, assuming no others have been posted since. Attached to each comment board is a control panel for customizing the way that comments are displayed. Users can control the chronological ordering of posts (newest or oldest first) and the number of posts to display on each page. Comments behave like other user submissions. Filters, smileys and HTML that work in nodes will also work with comments. The comment module provides specific features to inform site members when new comments have been posted.') .'</p>';
$output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="@comment">Comment page</a>.', array('@comment' => 'http://drupal.org/handbook/modules/comment/')) .'</p>';
return $output;
case 'admin/content/comment':
case 'admin/content/comment/new':
return '<p>'. t("Below is a list of the latest comments posted to your site. Click on a subject to see the comment, the author's name to edit the author's user information , 'edit' to modify the text, and 'delete' to remove their submission.") .'</p>';
case 'admin/content/comment/approval':
case 'admin/content/comment/list/approval':
return '<p>'. t("Below is a list of the comments posted to your site that need approval. To approve a comment, click on 'edit' and then change its 'moderation status' to Approved. Click on a subject to see the comment, the author's name to edit the author's user information, 'edit' to modify the text, and 'delete' to remove their submission.") .'</p>';
case 'admin/content/comment/settings':
return '<p>'. t("Comments can be attached to any node, and their settings are below. The display comes in two types: a 'flat list' where everything is flush to the left side, and comments come in chronological order, and a 'threaded list' where replies to other comments are placed immediately below and slightly indented, forming an outline. They also come in two styles: 'expanded', where you see both the title and the contents, and 'collapsed' where you only see the title. Preview comment forces a user to look at their comment by clicking on a 'Preview' button before they can actually add the comment.") .'</p>';
......
......@@ -9,8 +9,8 @@
/**
* Implementation of hook_help().
*/
function contact_help($section) {
switch ($section) {
function contact_help($path, $arg) {
switch ($path) {
case 'admin/help#contact':
$output = '<p>'. t('The contact module enables the use of both personal and site-wide contact forms, thereby facilitating easy communication within the community. While personal contact forms allow users to contact each other by e-mail, site-wide forms allow community members to contact the site administration from a central location. Users can specify a subject and message in the contact form, and also request that a copy of the e-mail be sent to their own address.') .'</p>';
$output .= '<p>'. t("Users can activate/deactivate their personal contact forms in their account settings. Upon activation, a contact tab will appear in their user profiles. Privileged users such as site administrators are able to contact users even if they have chosen not to enable this feature.") .'</p>';
......
......@@ -15,8 +15,8 @@
/**
* Implementation of hook_help().
*/
function dblog_help($section) {
switch ($section) {
function dblog_help($path, $arg) {
switch ($path) {
case 'admin/help#dblog':
$output = '<p>'. t('The dblog module monitors your system, capturing system events in a log to be reviewed by an authorized individual at a later time. This is useful for site administrators who want a quick overview of activities on their site. The logs also record the sequence of events, so it can be useful for debugging site errors.') .'</p>';
$output .= '<p>'. t('The dblog log is simply a list of recorded events containing usage data, performance data, errors, warnings and operational information. Administrators should check the dblog report on a regular basis to ensure their site is working properly.') .'</p>';
......
......@@ -9,8 +9,8 @@
/**
* Implementation of hook_help().
*/
function drupal_help($section) {
switch ($section) {
function drupal_help($path, $arg) {
switch ($path) {
case 'admin/help#drupal':
$output = '<p>'. t('The Drupal module uses the XML-RPC network communication protocol to connect your site with a central server that maintains a directory of client sites.') .'</p>';
$output .= t('<p>Enabling the Drupal module will allow you to:</p>
......
......@@ -17,14 +17,13 @@
/**
* Implementation of hook_help().
*/
function filter_help($section) {
switch ($section) {
function filter_help($path, $arg) {
switch ($path) {
case 'admin/help#filter':
$output = '<p>'. t("The filter module allows administrators to configure text input formats for the site. For example, an administrator may want a filter to strip out malicious HTML from user's comments. Administrators may also want to make URLs linkable even if they are only entered in an unlinked format.") .'</p>';
$output .= '<p>'. t('Users can choose between the available input formats when creating or editing content. Administrators can configure which input formats are available to which user roles, as well as choose a default input format. Administrators can also create new input formats. Each input format can be configured to use a selection of filters.') .'</p>';
$output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="@filter">Filter page</a>.', array('@filter' => 'http://drupal.org/handbook/modules/filter/')) .'</p>';
return $output;
case 'admin/settings/filters':
return t('
<p><em>Input formats</em> define a way of processing user-supplied text in Drupal. Every input format has its own settings of which <em>filters</em> to apply. Possible filters include stripping out malicious HTML and making URLs clickable.</p>
......@@ -32,15 +31,15 @@ function filter_help($section) {
<p>Below you can configure which input formats are available to which roles, as well as choose a default input format (used for imported content, for example).</p>
<p>Note that (1) the default format is always available to all roles, and (2) all filter formats can always be used by roles with the "administer filters" permission even if they are not explicitly listed in the Roles column of this table.</p>');
case 'admin/settings/filters/'. ((int)arg(3)):
case 'admin/settings/filters/%':
return t('
<p>Every <em>filter</em> performs one particular change on the user input, for example stripping out malicious HTML or making URLs clickable. Choose which filters you want to apply to text in this input format.</p>
<p>If you notice some filters are causing conflicts in the output, you can <a href="@rearrange">rearrange them</a>.</p>', array('@rearrange' => url('admin/settings/filters/'. arg(3) .'/order')));
<p>If you notice some filters are causing conflicts in the output, you can <a href="@rearrange">rearrange them</a>.</p>', array('@rearrange' => url('admin/settings/filters/'. $arg[3] .'/order')));
case 'admin/settings/filters/'. ((int)arg(3)) .'/configure':
return '<p>'. t('If you cannot find the settings for a certain filter, make sure you have enabled it on the <a href="@url">view tab</a> first.', array('@url' => url('admin/settings/filters/'. arg(3)))) .'</p>';
case 'admin/settings/filters/%/configure':
return '<p>'. t('If you cannot find the settings for a certain filter, make sure you have enabled it on the <a href="@url">view tab</a> first.', array('@url' => url('admin/settings/filters/'. $arg[3]))) .'</p>';
case 'admin/settings/filters/'. ((int)arg(3)) .'/order':
case 'admin/settings/filters/%/order':
return t('
<p>Because of the flexible filtering system, you might encounter a situation where one filter prevents another from doing its job. For example: a word in an URL gets converted into a glossary term, before the URL can be converted in a clickable link. When this happens, you will need to rearrange the order in which filters get executed.</p>
<p>Filters are executed from top-to-bottom. You can use the weight column to rearrange them: heavier filters "sink" to the bottom.</p>');
......
......@@ -9,8 +9,8 @@
/**
* Implementation of hook_help().
*/
function forum_help($section) {
switch ($section) {
function forum_help($path, $arg) {
switch ($path) {
case 'admin/help#forum':
$output = '<p>'. t('The forum module lets you create threaded discussion forums for a particular topic on your site. This is similar to a message board system such as phpBB. Forums are very useful because they allow community members to discuss topics with one another, and they are archived for future reference.') .'</p>';
$output .= '<p>'. t('Forums can be organized under what are called <em>containers</em>. Containers hold forums and, in turn, forums hold threaded discussions. Both containers and forums can be placed inside other containers and forums. By planning the structure of your containers and forums well, you make it easier for users to find a topic area of interest to them. Forum topics can be moved by selecting a different forum and can be left in the existing forum by selecting <em>leave a shadow copy</em>. Forum topics can also have their own URL.') .'</p>';
......
......@@ -21,6 +21,7 @@ function help_menu() {
$items['admin/help/'. $module] = array(
'title' => $module,
'page callback' => 'help_page',
'page arguments' => array(2),
'type' => MENU_CALLBACK,
);
}
......@@ -56,11 +57,12 @@ function help_main() {
}
function help_links_as_list() {
$empty_arg = drupal_help_arg();
$module_info = module_rebuild_cache();
$modules = array();
foreach (module_implements('help', TRUE) as $module) {
if (module_invoke($module, 'help', "admin/help#$module")) {
if (module_invoke($module, 'help', "admin/help#$module", $empty_arg)) {
$modules[] = $module;
}
}
......@@ -83,8 +85,8 @@ function help_links_as_list() {
/**
* Implementation of hook_help().
*/
function help_help($section) {
switch ($section) {
function help_help($path, $arg) {
switch ($path) {
case 'admin/help':
$output = t('<p>This guide explains what the various modules in <a href="@Drupal">Drupal</a> do and how to configure them. Additionally, you will find a glossary of basic Drupal terminology to help get you started.</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>
......@@ -105,16 +107,15 @@ function help_help($section) {
}
/**
* Menu callback; prints a page listing general help for all modules.
* Menu callback; prints a page listing general help for a module.
*/
function help_page() {
$name = arg(2);
function help_page($name) {
$output = '';
if (module_hook($name, 'help')) {
$module = drupal_parse_info_file(drupal_get_path('module', $name) .'/'. $name .'.info');
drupal_set_title($module['name']);
$temp = module_invoke($name, 'help', "admin/help#$name");
$temp = module_invoke($name, 'help', "admin/help#$name", drupal_help_arg());
if (empty($temp)) {
$output .= t("No help is available for module %module.", array('%module' => $module['name']));
}
......
......@@ -29,8 +29,8 @@
/**
* Implementation of hook_help().
*/
function locale_help($section) {
switch ($section) {
function locale_help($path, $arg) {
switch ($path) {
case 'admin/help#locale':
$output = '<p>'. t('The locale module allows you to present your Drupal site in a language other than the default English. You can use it to set up a multi-lingual website or replace given <em>built-in</em> text with text which has been customized for your site. Whenever the locale module encounters text which needs to be displayed, it tries to translate it into the currently selected language. If a translation is not available, then the string is remembered, so you can look up untranslated strings easily.') .'</p>';
$output .= '<p>'. t('The locale module provides two options for providing translations. The first is the integrated web interface, via which you can search for untranslated strings, and specify their translations. An easier and less time-consuming method is to import existing translations for your language. These translations are available as <em>GNU gettext Portable Object files</em> (<em>.po</em> files for short). Translations for many languages are available for download from the translation page.') .'</p>';
......@@ -39,7 +39,6 @@ function locale_help($section) {
return $output;
case 'admin/settings/language':
case 'admin/settings/language/overview':
return t("<p>Drupal provides support for the translation of its interface text into different languages. This page provides an overview of the installed languages. You can add a language on the <a href=\"@add-language\">add language page</a>, or directly by <a href=\"@import\">importing a translation</a>. If multiple languages are enabled, registered users will be able to set their preferred language. The site default will be used for anonymous visitors and for users without their own settings.</p><p>Drupal interface translations may be added or extended by several courses: by <a href=\"@import\">importing</a> an existing translation, by <a href=\"@search\">translating everything</a> from scratch, or by a combination of these approaches.</p>", array("@search" => url("admin/build/translate/search"), "@import" => url("admin/build/translate/import"), "@add-language" => url("admin/settings/language/add")));
case 'admin/settings/language/add':
return '<p>'. t("You need to add all languages in which you would like to display the site interface. If you can't find the desired language in the quick-add dropdown, then you will need to provide the proper language code yourself. The language code may be used to negotiate with browsers and to present flags, etc., so it is important to pick a code that is standardised for the desired language. You can also add a language by <a href=\"@import\">importing a translation</a>.", array("@import" => url("admin/build/translate/import"))) .'</p>';
......@@ -47,7 +46,6 @@ function locale_help($section) {
return '<p>'. t('The language used to display a web page is determined with a negotiation algorithm. You can choose how this algorithm should work. By default, there is no negotiation and the default language is used. You can use path prefixes (like "de" and "it" for German and Italian content) with different fallback options, so you can have web addresses like /de/contact and /it/contact. Alternatively you can use custom domains like de.example.com and it.example.com. Customize path prefixes and set domain names on the <a href="@languages">language editing pages</a>.', array('@languages' => url('admin/settings/language'))) .'</p>';
case 'admin/build/translate':
case 'admin/build/translate/overview':
return '<p>'. t("This page provides an overview of interface translation on the site. Drupal groups all translatable strings in so called 'text groups'. Text groups are useful, because you can focus your translation efforts on the groups of text you care most about. For example, a translation team could choose not to fully translate the text group that includes all the long help texts on the administration pages. Similarly, text groups are useful to ensure that certain aspects of the site are always fully translated.") . '</p>';
case 'admin/build/translate/import':
return '<p>'. t("This page allows you to import a translation provided in the gettext Portable Object (.po) format. The easiest way to get your site translated is to obtain an existing Drupal translation and to import it. You can find existing translations on the <a href=\"@url\">Drupal translation page</a>. Note that importing a translation file might take a while.", array('@url' => 'http://drupal.org/project/translations')) .'</p>';
......
......@@ -9,17 +9,17 @@
/**
* Implementation of hook_help().
*/
function menu_help($section) {
switch ($section) {
function menu_help($path, $arg) {
switch ($path) {
case 'admin/help#menu':
$output = t('<p>Menus are a collection of links (menu items) used to navigate a website. The menu module provides an interface to control and customize the powerful menu system that comes with Drupal. Menus are primarily displayed as a hierarchical list of links using Drupal\'s highly flexible <a href="@admin-block">blocks</a> feature. Each menu automatically creates a block of the same name. By default, new menu items are placed inside a built-in menu labelled %navigation, but administrators can also create custom menus.</p>
<p>Drupal themes generally provide out-of-the-box support for two menus commonly labelled %primary-links and %secondary-links. These are sets of links which are usually displayed in the header or footer of each page (depending on the currently active theme). Any menu can be designated as the primary or secondary links menu via the <a href="@menu-settings">menu settings page</a>.</p>
<p>Drupal themes generally provide out-of-the-box support for two menus commonly labelled %primary-links and %secondary-links. These are sets of links which are usually displayed in the header or footer of each page (depending on the currently active theme).</p>
Menu administration tabs:
<ul>
<li>On the administer menu page, administrators can "edit" to change the title, description, parent or weight of a menu item. Under the "operations" column, click on "enable/disable" to toggle a menu item on or off. Only menu items which are enabled are displayed in the corresponding menu block. Note that the default menu items generated by the menu module cannot be deleted, only disabled.</li>
<li>Use the "add menu" tab to submit a title for a new custom menu. Once submitted, the menu will appear in a list toward the bottom of the administer menu page underneath the main navigation menu. Under the menu name there will be links to edit or delete the menu, and a link to add new items to the menu.</li>
<li>Use the "add menu item" tab to create new links in either the navigation or a custom menu (such as a primary/secondary links menu). Select the parent item to place the new link within an existing menu structure. For top level menu items, choose the name of the menu in which the link is to be added.</li>
</ul>', array('%navigation' => 'Navigation', '%primary-links' => 'primary links', '%secondary-links' => 'secondary links', '@admin-block' => url('admin/build/block'), '@menu-settings' => url('admin/build/menu/settings')));
</ul>', array('%navigation' => 'Navigation', '%primary-links' => 'Primary links', '%secondary-links' => 'Secondary links', '@admin-block' => url('admin/build/block'), '@menu-settings' => url('admin/build/menu/settings')));
$output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="@menu">Menu page</a>.', array('@menu' => 'http://drupal.org/handbook/modules/menu/')) .'</p>';
return $output;
case 'admin/build/menu':
......
......@@ -12,8 +12,8 @@
/**
* Implementation of hook_help().
*/
function node_help($section) {
switch ($section) {
function node_help($path, $arg) {
switch ($path) {
case 'admin/help#node':
$output = '<p>'. t('All content in a website is stored and treated as <b>nodes</b>. Therefore nodes are any postings such as blogs, stories, polls and forums. The node module manages these content types and is one of the strengths of Drupal over other content management systems.') .'</p>';
$output .= '<p>'. t('Treating all content as nodes allows the flexibility of creating new types of content. It also allows you to painlessly apply new features or changes to all content. Comments are not stored as nodes but are always associated with a node.') .'</p>';
......@@ -27,20 +27,24 @@ function node_help($section) {
');
$output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="@node">Node page</a>.', array('@node' => 'http://drupal.org/handbook/modules/node/')) .'</p>';
return $output;
case 'admin/content/node':
return ' '; // Return a non-null value so that the 'more help' link is shown.
case 'admin/content/search':
return '<p>'. t('Enter a simple pattern to search for a post. Words are matched exactly. Phrases can be surrounded by quotes to do an exact search.') .'</p>';
case 'admin/content/types':
return '<p>'. t('Below is a list of all the content types on your site. All posts that exist on your site are instances of one of these content types.') .'</p>';
case 'admin/content/types/add':
return '<p>'. t('To create a new content type, enter the human-readable name, the machine-readable name, and all other relevant fields that are on this page. Once created, users of your site will be able to create posts that are instances of this content type.') .'</p>';
case 'node/%/revisions':
return '<p>'. t('The revisions let you track differences between multiple versions of a post.') .'</p>';
case 'node/%/edit':
$node = node_load($arg[1]);
$type = node_get_types('type', $node->type);
return '<p>'. (isset($type->help) ? filter_xss_admin($type->help) : '') .'</p>';
}
if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == 'revisions') {
return '<p>'. t('The revisions let you track differences between multiple versions of a post.') .'</p>';
}
if (arg(0) == 'node' && arg(1) == 'add' && $type = arg(2)) {
$type = node_get_types('type', str_replace('-', '_', arg(2)));
if ($arg[0] == 'node' && $arg[1] == 'add' && $arg[2]) {
$type = node_get_types('type', str_replace('-', '_', $arg[2]));
return '<p>'. (isset($type->help) ? filter_xss_admin($type->help) : '') .'</p>';
}
}
......
......@@ -36,8 +36,8 @@ function openid_menu() {
/**
* Implementation of hook_help().
*/
function openid_help($section) {
switch ($section) {
function openid_help($path, $arg) {
switch ($path) {
case 'user/%/openid':
return t('You may login to this site using an OpenID. You may add your OpenId URLs below, and also see a list of any OpenIDs which have already been added.');
}
......
......@@ -9,8 +9,8 @@
/**
* Implementation of hook_help().
*/
function path_help($section) {
switch ($section) {
function path_help($path, $arg) {
switch ($path) {
case 'admin/help#path':
$output = '<p>'. t('The path module allows you to specify aliases for Drupal URLs. Such aliases improve readability of URLs for your users and may help internet search engines to index your content more effectively. More than one alias may be created for a given page.') .'</p>';
$output .= t('<p>Some examples of URL aliases are:</p>
......@@ -26,7 +26,6 @@ function path_help($section) {
$output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="@path">Path page</a>.', array('@path' => 'http://drupal.org/handbook/modules/path/')) .'</p>';
return $output;
case 'admin/build/path':
case 'admin/build/path/list':
return '<p>'. t("Drupal provides users complete control over URLs through aliasing. This feature is typically used to make URLs human-readable or easy to remember. For example, one could map the relative URL 'node/1' onto 'about'. Each system path can have multiple aliases.") .'</p>';
case 'admin/build/path/add':
return '<p>'. t('Enter the path you wish to create the alias for, followed by the name of the new alias.') .'</p>';
......
......@@ -10,8 +10,8 @@
/**
* Implementation of hook_help().
*/
function php_help($section) {
switch ($section) {
function php_help($path, $arg) {
switch ($path) {
case 'admin/help#php':
return t('Adds a filter option to include PHP in content.');
}
......
......@@ -9,8 +9,8 @@
/**
* Implementation of hook_help().
*/
function ping_help($section) {
switch ($section) {
function ping_help($path, $arg) {
switch ($path) {
case 'admin/help#ping':
$output = '<p>'. t('The ping module is useful for notifying interested sites that your site has changed. It automatically sends notifications (called "pings") to the <a href="@external-http-pingomatic-com">pingomatic</a> service to tell it that your site has changed. In turn pingomatic will ping other services such as weblogs.com, Technorati, blo.gs, BlogRolling, Feedster.com, Moreover, etc.', array('@external-http-pingomatic-com' => 'http://pingomatic.com/')) .'</p>';
$output .= '<p>'. t('The ping module requires <code>cron</code> or a similar periodic job scheduler to be enabled.') .'</p>';
......
......@@ -10,8 +10,8 @@
/**
* Implementation of hook_help().
*/
function poll_help($section) {
switch ($section) {
function poll_help($path, $arg) {
switch ($path) {
case 'admin/help#poll':
$output = '<p>'. t('The poll module can be used to create simple polls for site users. A poll is a simple multiple choice questionnaire which displays the cumulative results of the answers to the poll. Having polls on the site is a good way to get instant feedback from community members.') .'</p>';
$output .= '<p>'. t('Users can create a poll. The title of the poll should be the question, then enter the answers and the "base" vote counts. You can also choose the time period over which the vote will run.The <a href="@poll">poll</a> item in the navigation menu will take you to a page where you can see all the current polls, vote on them (if you haven\'t already) and view the results.', array('@poll' => url('poll'))) .'</p>';
......
......@@ -29,8 +29,8 @@
/**
* Implementation of hook_help().
*/
function profile_help($section) {
switch ($section) {
function profile_help($path, $arg) {
switch ($path) {
case 'admin/help#profile':
$output = '<p>'. t('The profile module allows you to define custom fields (such as country, real name, age, ...) in the user profile. This permits users of a site to share more information about themselves, and can help community-based sites to organize users around profile fields.') .'</p>';
$output .= t('<p>The following types of fields can be added to the user profile:</p>
......
......@@ -93,8 +93,8 @@
/**
* Implementation of hook_help().
*/
function search_help($section) {
switch ($section) {
function search_help($path, $arg) {
switch ($path) {
case 'admin/help#search':
$output = '<p>'. t('The search module adds the ability to search for content by keywords. Search is often the only practical way to find content on a large site. Search is useful for finding users and posts by searching on keywords.') .'</p>';
$output .= '<p>'. t('The search engine works by maintaining an index of the words in your site\'s content. It indexes the posts and users. You can adjust the settings to tweak the indexing behaviour. Note that the search requires cron to be set up correctly. The index percentage sets the maximum amount of items that will be indexed in one cron run. Set this number lower if your cron is timing out or if PHP is running out of memory.') .'</p>';
......
......@@ -9,8 +9,8 @@
/**
* Implementation of hook_help().
*/
function statistics_help($section) {
switch ($section) {
function statistics_help($path, $arg) {
switch ($path) {
case 'admin/help#statistics':
$output = '<p>'. t('The statistics module keeps track of numerous statistics of site usage. It counts how many times, and from where each of your posts is viewed. The statistics module can be used to learn many useful things about how users are interacting with each other and with your site.') .'</p>';
$output .= t('<p>Statistics module features</p>
......
......@@ -16,8 +16,8 @@
/**
* Implementation of hook_help().
*/
function syslog_help($section) {
switch ($section) {
function syslog_help($path, $arg) {
switch ($path) {
case 'admin/help#syslog':
return '<p>'. t('Provides the facility to log Drupal messages to the operating systems\' syslog facility.') .'</p>';
}
......
......@@ -20,10 +20,10 @@
/**
* Implementation of hook_help().
*/
function system_help($section) {
function system_help($path, $arg) {
global $base_url;
switch ($section) {
switch ($path) {
case 'admin/help#system':
$output = '<p>'. t('The system module provides system-wide defaults such as running jobs at a particular time, and storing web pages to improve efficiency. The ability to run scheduled jobs makes administering the website more usable, as administrators do not have to manually start jobs. The storing of web pages, or caching, allows the site to efficiently re-use web pages and improve website performance. The settings module provides control over preferences, behaviours including visual and operational settings.') .'</p>';
$output .= '<p>'. t('Some modules require regularly scheduled actions, such as cleaning up logfiles. Cron, which stands for chronograph, is a periodic command scheduler executing commands at intervals specified in seconds. It can be used to control the execution of daily, weekly and monthly jobs (or anything with a period measured in seconds). The aggregator module periodically updates feeds using cron. Ping periodically notifies services of new content on your site. Search periodically indexes the content on your site. Automating tasks is one of the best ways to keep a system running smoothly, and if most of your administration does not require your direct involvement, cron is an ideal solution. Cron can, if necessary, also be run manually.') .'</p>';
......@@ -36,12 +36,12 @@ function system_help($section) {
return '<p>'. t('This page shows you all available administration tasks for each module.') .'</p>';
case 'admin/build/themes':
return '<p>'. t('Select which themes are available to your users and specify the default theme. To configure site-wide display settings, click the "configure" task above. Alternately, to override these settings in a specific theme, click the "configure" link for the corresponding theme. Note that different themes may have different regions available for rendering content like blocks. If you want consistency in what your users see, you may wish to enable only one theme.') .'</p>';
case 'admin/build/themes/settings':
return '<p>'. t('These options control the default display settings for your entire site, across all themes. Unless they have been overridden by a specific theme, these settings will be used.') .'</p>';
case 'admin/build/themes/settings/'. arg(4):
$reference = explode('.', arg(4), 2);
case 'admin/build/themes/settings/'. $arg[4]:
$reference = explode('.', $arg[4], 2);
$theme = array_pop($reference);
return '<p>'. t('These options control the display settings for the <code>%template</code> theme. When your site is displayed using this theme, these settings will be used. By clicking "Reset to defaults," you can choose to use the <a href="@global">global settings</a> for this theme.', array('%template' => $theme, '@global' => url('admin/build/themes/settings'))) .'</p>';
case 'admin/build/themes/settings':
return '<p>'. t('These options control the default display settings for your entire site, across all themes. Unless they have been overridden by a specific theme, these settings will be used.') .'</p>';
case 'admin/build/modules':
return t('<p>Modules are plugins for Drupal that extend its core functionality. Here you can select which modules are enabled. Click on the name of the module in the navigation menu for their individual configuration pages. Once a module is enabled, new <a href="@permissions">permissions</a> might be made available. Modules can automatically be temporarily disabled to reduce server load when your site becomes extremely busy by enabling the throttle.module and checking throttle. The auto-throttle functionality must be enabled on the <a href="@throttle">throttle configuration page</a> after having enabled the throttle module.</p>
<p>It is important that <a href="@update-php">update.php</a> is run every time a module is updated to a newer version.</p><p>You can find all administration tasks belonging to a particular module on the <a href="@by-module">administration by module page</a>.</p>', array('@permissions' => url('admin/user/access'), '@throttle' => url('admin/settings/throttle'), '@update-php' => $base_url .'/update.php', '@by-module' => url('admin/by-module')));
......@@ -188,7 +188,7 @@ function system_menu() {
'title' => 'Themes',
'description' => 'Change which theme your site uses or allows users to set.',
'page callback' => 'drupal_get_form',
'page arguments' => array('system_themes_form'),
'page arguments' => array('system_themes_form', NULL),
);
$items['admin/build/themes/select'] = array(
'title' => 'List',
......@@ -198,7 +198,6 @@ function system_menu() {
);
$items['admin/build/themes/settings'] = array(
'title' => 'Configure',
'page arguments' => array('system_theme_settings'),
'type' => MENU_LOCAL_TASK,
);
// Theme configuration subtabs
......@@ -2687,6 +2686,8 @@ function system_admin_by_module() {
return 'This page awaits rewrite'; // TODO: this needs to be rewritten for the new menu system.
$modules = module_rebuild_cache();
$menu_items = array();
$help_arg = drupal_help_arg();
foreach ($modules as $file) {
$module = $file->name;
if ($module == 'help') {
......@@ -2699,7 +2700,7 @@ function system_admin_by_module() {
if (count($admin_tasks)) {
// Check for help links.
if (module_invoke($module, 'help', "admin/help#$module")) {
if (module_invoke($module, 'help', "admin/help#$module", $help_arg)) {
$admin_tasks[100] = l(t('Get help'), "admin/help/$module");
}
......
......@@ -1475,8 +1475,8 @@ function taxonomy_rss_item($node) {
/**
* Implementation of hook_help().
*/
function taxonomy_help($section) {
switch ($section) {
function taxonomy_help($path, $arg) {
switch ($path) {
case 'admin/help#taxonomy':
$output = '<p>'. t('The taxonomy module is one of the most popular features because users often want to create categories to organize content by type. A simple example would be organizing a list of music reviews by musical genre.') .'</p>';
$output .= '<p>'. t('Taxonomy is the study of classification. The taxonomy module allows you to define vocabularies (sets of categories) which are used to classify content. The module supports hierarchical classification and association between terms, allowing for truly flexible information retrieval and classification. The taxonomy module allows multiple lists of categories for classification (controlled vocabularies) and offers the possibility of creating thesauri (controlled vocabularies that indicate the relationship of terms) and taxonomies (controlled vocabularies where relationships are indicated hierarchically). To view and manage the terms of each vocabulary, click on the associated <em>list terms</em> link. To delete a vocabulary and all its terms, choose <em>edit vocabulary.</em>') .'</p>';
......
......@@ -114,8 +114,8 @@ function throttle_exit() {
/**
* Implementation of hook_help().
*/
function throttle_help($section) {
switch ($section) {
function throttle_help($path, $arg) {
switch ($path) {
case 'admin/help#throttle':
$output = '<p>'. t('The throttle module provides a congestion control throttling mechanism for automatically detecting a surge in incoming traffic. If the site gets linked to by a popular website, or otherwise comes under a "Denial of Service" (DoS) attack, your webserver might become overwhelmed. This mechanism is utilized by other modules to automatically optimize their performance by temporarily disabling CPU-intensive functionality. For example, in the site theme, you might choose to disable pictures when the site is too busy (reducing bandwidth), or in modules, you might choose to disable some complicated logic (reducing CPU utilization).') .'</p>';
$output .= '<p>'. t('The congestion control throttle can be automatically enabled when the number of anonymous or authenticated users currently visiting the site exceeds the specified threshold. ') .'</p>';
......
......@@ -9,8 +9,8 @@
/**
* Implementation of hook_help().
*/
function tracker_help($section) {
switch ($section) {
function tracker_help($path, $arg) {
switch ($path) {
case 'admin/help#tracker':
$output = '<p>'. t('The tracker module displays the most recently added or updated content to the website allowing users to see the most recent contributions. The tracker module provides user level tracking for those who like to follow the contributions of particular authors.') .'</p>';
$output .= '<p>'. t('The &quot;recent posts&quot; page is available via a link in the navigation menu block and contains a reverse chronological list of new and recently-updated content. The table displays the content type, the title, the author\'s name, how many comments that item has received, and when it was last updated. Updates include any changes to the text, either by the original author or someone else, as well as any new comments added to an item. To use the tracker module to <em>watch</em> for a user\'s updated content, click on that user\'s profile, then the <em>track</em> tab.') .'</p>';
......
......@@ -28,8 +28,8 @@
/**
* Implementation of hook_help().
*/
function translation_help($section) {
switch ($section) {
function translation_help($path, $arg) {
switch ($path) {
case 'admin/help#translation':
$output = '<p>'. t('The <em>translation</em> module allows content translation for multilingual sites.') .'</p>';
$output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="@translation">Translation page</a>.', array('@translation' => 'http://drupal.org/handbook/modules/translation/')) .'</p>';
......
......@@ -10,8 +10,8 @@
/**
* Implementation of hook_help().
*/
function upload_help($section) {
switch ($section) {
function upload_help($path, $arg) {
switch ($path) {
case 'admin/help#upload':
$output = '<p>'. t('The upload module allows users to upload files to the site. The ability to upload files to a site is important for members of a community who want to share work. It is also useful to administrators who want to keep uploaded files connected to a node or page.') .'</p>';
$output .= '<p>'. t('Users with the upload files permission can upload attachments. You can choose which post types can take attachments on the content types settings page. Each user role can be customized for the file size of uploads, and the dimension of image files.') .'</p>';
......
......@@ -2767,10 +2767,10 @@ function user_admin($callback_arg = '') {
/**
* Implementation of hook_help().
*/
function user_help($section) {
function user_help($path, $arg) {
global $user;
switch ($section) {
switch ($path) {
case 'admin/help#user':
$output = '<p>'. t('The user module allows users to register, login, and log out. Users benefit from being able to sign on because it associates content they create with their account and allows various permissions to be set for their roles. The user module supports user roles which can setup fine grained permissions allowing each role to do only what the administrator wants them to. Each user is assigned to one or more roles. By default there are two roles <em>anonymous</em> - a user who has not logged in, and <em>authenticated</em> a user who has signed up and who has been authorized.') .'</p>';
$output .= '<p>'. t('Users can use their own name or handle and can fine tune some personal configuration settings through their individual my account page. Registered users need to authenticate by supplying either a local username and password, or a remote username and password such as DelphiForums ID, or one from a Drupal powered website. A visitor accessing your website is assigned an unique ID, the so-called session ID, which is stored in a cookie. For security\'s sake, the cookie does not contain personal information but acts as a key to retrieve the information stored on your server.') .'</p>';
......