Index: node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.961
diff -u -r1.961 node.module
--- node/node.module 6 May 2008 12:18:48 -0000 1.961
+++ node/node.module 9 May 2008 17:07:22 -0000
@@ -53,6 +53,13 @@
$node = node_load($arg[1]);
$type = node_get_types('type', $node->type);
return (!empty($type->help) ? '
' . filter_xss_admin($type->help) . '
' : '');
+ case 'search#noresults':
+ $noresults = array(
+ t('Check if your spelling is correct.'),
+ t('Remove quotes around phrases to match each word individually: "blue smurf" will match less than blue smurf.'),
+ t('Consider loosening your query with OR: blue smurf will match less than blue OR smurf.'),
+ );
+ return theme('item_list', $noresults);
}
if ($arg[0] == 'node' && $arg[1] == 'add' && $arg[2]) {
Index: search/search.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.module,v
retrieving revision 1.256
diff -u -r1.256 search.module
--- search/search.module 6 May 2008 12:18:50 -0000 1.256
+++ search/search.module 9 May 2008 17:07:22 -0000
@@ -102,12 +102,6 @@
return $output;
case 'admin/settings/search':
return '' . t('The search engine maintains an index of words found in your site\'s content. To build and maintain this index, a correctly configured cron maintenance task is required. Indexing behavior can be adjusted using the settings below.', array('@cron' => url('admin/reports/status'))) . '
';
- case 'search#noresults':
- return t('
-- Check if your spelling is correct.
-- Remove quotes around phrases to match each word individually: "blue smurf" will match less than blue smurf.
-- Consider loosening your query with OR: blue smurf will match less than blue OR smurf.
-
');
}
}
Index: search/search.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.pages.inc,v
retrieving revision 1.5
diff -u -r1.5 search.pages.inc
--- search/search.pages.inc 14 Apr 2008 17:48:41 -0000 1.5
+++ search/search.pages.inc 9 May 2008 17:07:22 -0000
@@ -35,7 +35,8 @@
$results = theme('box', t('Search results'), $results);
}
else {
- $results = theme('box', t('Your search yielded no results'), search_help('search#noresults', drupal_help_arg()));
+ $help = module_invoke($type, 'help', 'search#noresults', drupal_help_arg());
+ $results = theme('box', t('Your search yielded no results'), $help);
}
}
Index: search/search.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.test,v
retrieving revision 1.1
diff -u -r1.1 search.test
--- search/search.test 20 Apr 2008 18:23:29 -0000 1.1
+++ search/search.test 9 May 2008 17:17:30 -0000
@@ -159,4 +159,35 @@
// Check range.
$this->assertEqual(!count($scores) || (min($scores) > 0.0 && max($scores) <= 1.0001), TRUE, "Query scoring '$query'");
}
+
}
+
+
+class SearchNoResultsTestCase extends DrupalWebTestCase {
+ /**
+ * Implementation of getInfo().
+ */
+ function getInfo() {
+ return array(
+ 'name' => t('Search help test'),
+ 'description' => t('Tests the search help hook'),
+ 'group' => t('Search'),
+ );
+ }
+
+ /**
+ * Implementation setUp().
+ */
+ function setUp() {
+ parent::setUp('search');
+ }
+
+ function testSearchHelpHook() {
+ $modules = module_implements('search', true);
+ foreach($modules as $module) {
+ $output = module_invoke($module,'help', 'search#noresults', drupal_help_arg());
+ error_log("Output is: $output");
+ $this->assertTrue($output != '', "Module $module implements noresults help.");
+ }
+ }
+}
\ No newline at end of file
Index: user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.907
diff -u -r1.907 user.module
--- user/user.module 7 May 2008 19:34:24 -0000 1.907
+++ user/user.module 9 May 2008 17:07:22 -0000
@@ -1852,6 +1852,12 @@
', array('@permissions' => url('admin/user/permissions')));
case 'admin/user/search':
return '' . t('Enter a simple pattern ("*" may be used as a wildcard match) to search for a username or e-mail address. For example, one may search for "br" and Drupal might return "brian", "brad", and "brenda@example.com".') . '
';
+ case 'search#noresults':
+ $noresults = array(
+ t('Check if your spelling is correct.'),
+ t('Beware that search user only looks for the Drupal user name and not the user\'s full name'),
+ );
+ return theme('item_list', $noresults);
}
}