Commit f1f6fec8 authored by gisle's avatar gisle
Browse files

Issue #2492565 by gisle: Moved Advanced help to a tab under help

parent 0ce617f4
......@@ -34,28 +34,38 @@
/**
* Implements hook_menu().
*
* Strings in hook_help() should not be run through t().
*/
function advanced_help_menu() {
// View help topic index.
//
// This is structured little oddly so that POTX can handle the translation.
if (module_exists('help')) {
$items['admin/advanced_help'] = array(
'title' => 'Advanced help',
$help_exists = module_exists('help') ? TRUE : FALSE;
if ($help_exists) {
// Add tabs to core Help page to access Advanced Help.
$items['admin/help/tab1'] = array(
'title' => 'Help',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => 0,
);
$items['admin/help/ah'] = array(
'title' => 'Advanced Help',
'page callback' => 'advanced_help_index_page',
'access arguments' => array('view advanced help index'),
'weight' => 9,
'type' => MENU_LOCAL_TASK,
'weight' => 2,
);
}
else {
$items['admin/advanced_help'] = array(
// Make Advanced Help the normal help.
$items['admin/help/ah'] = array(
'title' => 'Help',
'page callback' => 'advanced_help_index_page',
'access arguments' => array('view advanced help index'),
'type' => MENU_NORMAL_ITEM,
'weight' => 9,
);
}
$items['advanced_help/search/%'] = array(
$items['help/ah/search/%'] = array(
'title' => 'Search help',
'page callback' => 'advanced_help_search_view',
'page arguments' => array('advanced_help'),
......@@ -134,9 +144,9 @@ function advanced_help_search_get_keys() {
if (!isset($return)) {
// Extract keys as remainder of path
// Note: support old GET format of searches for existing links.
$path = explode('/', $_GET['q'], 3);
$path = explode('/', $_GET['q'], 4);
$keys = empty($_REQUEST['keys']) ? '' : $_REQUEST['keys'];
$return = count($path) == 3 ? $path[2] : $keys;
$return = count($path) == 4 ? $path[3] : $keys;
}
return $return;
}
......@@ -149,7 +159,7 @@ function advanced_help_search_view() {
return drupal_not_found();
}
$breadcrumb[] = advanced_help_l(t('Help'), 'admin/advanced_help');
$breadcrumb[] = advanced_help_l(t('Advanced help'), 'admin/help/ah');
if (!isset($_POST['form_id'])) {
$keys = advanced_help_search_get_keys();
......@@ -216,7 +226,7 @@ function advanced_help_index_page($module = '') {
advanced_help_get_topic_hierarchy($topics);
$items = advanced_help_get_tree($topics, $topics[$module]['']['children']);
$breadcrumb[] = advanced_help_l(t('Help'), 'admin/advanced_help');
$breadcrumb[] = advanced_help_l(t('Advanced help'), 'admin/help/ah');
drupal_set_title(t('@module help index', array('@module' => advanced_help_get_module_name($module))));
$output['items-module'] = array(
......@@ -247,11 +257,11 @@ function advanced_help_index_page($module = '') {
else {
$name = t($module_name);
}
$items[] = advanced_help_l($name, "admin/advanced_help/$module");
$items[] = advanced_help_l($name, "admin/help/ah/$module");
}
}
drupal_set_title(t('Module help index'));
drupal_set_title(t('Advanced help'));
$output['items-nomodule'] = array(
'#theme' => 'item_list',
'#items' => $items,
......@@ -362,7 +372,7 @@ function advanced_help_form_system_modules_alter(&$form, &$form_state) {
$form['modules'][$group][$module]['links']['help'] = array(
'#type' => 'link',
'#title' => t('Help'),
'#href' => "admin/advanced_help/$module",
'#href' => "admin/help/ah/$module",
'#options' => array(
'attributes' => array(
'class' => array('module-link', 'module-link-help'),
......@@ -383,7 +393,7 @@ function advanced_help_form_system_modules_alter(&$form, &$form_state) {
*/
function advanced_help_search_form($form, &$form_state, $keys = '') {
module_load_include('inc', 'search', 'search.pages');
$form = search_form($form, $form_state, 'admin/advanced_help', $keys, 'advanced_help', t('Search help'));
$form = search_form($form, $form_state, 'admin/help/ah', $keys, 'advanced_help', t('Search help'));
$form['basic']['inline']['submit']['#validate'] = array('search_form_validate');
$form['basic']['inline']['submit']['#submit'] = array('advanced_help_search_form_submit');
......@@ -404,10 +414,10 @@ function advanced_help_search_form_submit($form, &$form_state) {
$popup = !empty($_GET['popup']) && user_access('view advanced help popup');
if ($popup) {
$form_state['redirect'] = array('advanced_help/search/' . $keys, array('query' => array('popup' => 'true')));
$form_state['redirect'] = array('help/ah/search/' . $keys, array('query' => array('popup' => 'true')));
}
else {
$form_state['redirect'] = 'advanced_help/search/' . $keys;
$form_state['redirect'] = 'help/ah/search/' . $keys;
}
}
......@@ -477,8 +487,8 @@ function advanced_help_topic_page($module, $topic) {
$breadcrumb[] = advanced_help_l($parent['title'], "help/$pmodule/$ptopic");
}
$breadcrumb[] = advanced_help_l(advanced_help_get_module_name($pmodule), "admin/advanced_help/$pmodule");
$breadcrumb[] = advanced_help_l(t('Help'), "admin/advanced_help");
$breadcrumb[] = advanced_help_l(advanced_help_get_module_name($pmodule), "admin/help/ah/$pmodule");
$breadcrumb[] = advanced_help_l(t('Help'), "admin/help/ah");
$output = advanced_help_view_topic($module, $topic, $popup);
if (empty($output)) {
......@@ -716,7 +726,7 @@ function advanced_help_view_topic($module, $topic, $popup = FALSE) {
$up = "help/$parent[0]/$parent[1]";
}
else {
$up = "admin/advanced_help/$module";
$up = "admin/help/ah/$module";
}
$siblings = $topics[$parent_module][$parent_topic]['children'];
......
......@@ -34,6 +34,13 @@ keywords.</p>
<h2 id="use">Using the module</h2>
<p>When you enable the module, a new tab with the legend “Advanced
help” will show up under “Help”:
<div class="ta-center">
<img class="help-img-center" alt="ahelp_tab.png" src="&path&ahelp_tab.png" width="661" height="225" border="1" />
</div>
<p>By itself, this module doesn't do much. The <strong>Advanced
help</strong> assists other modules and themes in showing help texts.
Nothing will show up until you enable at least one other module that
......@@ -95,5 +102,6 @@ answering &amp; closing support requests.</p>
<li><a href="https://www.drupal.org/u/redndahead">redndahead</a> (8 commits)</li>
<li><a href="https://www.drupal.org/u/dmitrig01">dmitrig01</a> (3 commits)</li>
<li><a href="https://www.drupal.org/u/amitgoyal">amitgoyal </a> (5 commits)</li>
<li><a href="https://www.drupal.org/u/gisle">gisle</a> (current maintainer)</li>
<li><a href="https://www.drupal.org/u/gisle">gisle</a> (current maintainer, D7)</li>
<li><a href="https://www.drupal.org/u/gnuget">gnuget</a> (current maintainer, D8)</li>
</ul>
......@@ -43,6 +43,13 @@ innhold på sidene med avansert hjelp er søkbart med nøkkelord.</p>
<h2 id="use">Bruk av modulen</h2>
<p>When you enable the module, a new tab with the legend “Advanced
help” will show up under “Help”:
<div class="ta-center">
<img class="help-img-center" alt="ahelp_tab.png" src="&path&ahelp_tab.png" width="661" height="225" border="1" />
</div>
<p>By itself, this module doesn't do much. The <strong>Avansert
hjelp</strong> assists other modules and themes in showing help texts.
Nothing will show up until you enable at least one other module that
......@@ -104,5 +111,6 @@ answering &amp; closing support requests.</p>
<li><a href="https://www.drupal.org/u/redndahead">redndahead</a> (8 commits)</li>
<li><a href="https://www.drupal.org/u/dmitrig01">dmitrig01</a> (3 commits)</li>
<li><a href="https://www.drupal.org/u/amitgoyal">amitgoyal </a> (5 commits)</li>
<li><a href="https://www.drupal.org/u/gisle">gisle</a> (nåværende administrator)</li>
<li><a href="https://www.drupal.org/u/gisle">gisle</a> (nåværende administrator, D7)</li>
<li><a href="https://www.drupal.org/u/gnuget">gnuget</a> (nåværende administrator, D8)</li>
</ul>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment