diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-12-12 20:49:34 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-12-12 20:49:34 +0000 |
commit | e096263f3ca6048f646c26f6cf1d6635229a4467 (patch) | |
tree | dcbdd8261a545dc29f7d5421d342f5aead628149 /modules/search | |
parent | 6a13eb22fc5c7c2a27d6c18e8ec99493f1566350 (diff) | |
download | brdo-e096263f3ca6048f646c26f6cf1d6635229a4467.tar.gz brdo-e096263f3ca6048f646c26f6cf1d6635229a4467.tar.bz2 |
- Patch #115540 by Wesley Tanaka, douggreen, WorldFallz, dww: 'no results' page was not themeable, and generated invalid HTML.
Diffstat (limited to 'modules/search')
-rw-r--r-- | modules/search/search-results.tpl.php | 14 | ||||
-rw-r--r-- | modules/search/search.module | 12 | ||||
-rw-r--r-- | modules/search/search.pages.inc | 3 |
3 files changed, 16 insertions, 13 deletions
diff --git a/modules/search/search-results.tpl.php b/modules/search/search-results.tpl.php index 02e1f4e2b..1d347f669 100644 --- a/modules/search/search-results.tpl.php +++ b/modules/search/search-results.tpl.php @@ -21,7 +21,13 @@ * @see template_preprocess_search_results() */ ?> -<dl class="search-results <?php print $type; ?>-results"> - <?php print $search_results; ?> -</dl> -<?php print $pager; ?> +<?php if ($search_results) : ?> + <h2><?php print t('Search results');?></h2> + <dl class="search-results <?php print $type; ?>-results"> + <?php print $search_results; ?> + </dl> + <?php print $pager; ?> +<?php else : ?> + <h2><?php print t('Your search yielded no results');?></h2> + <?php print search_help('search#noresults', drupal_help_arg()); ?> +<?php endif; ?> diff --git a/modules/search/search.module b/modules/search/search.module index 513500aa1..f1acc869e 100644 --- a/modules/search/search.module +++ b/modules/search/search.module @@ -968,13 +968,11 @@ function search_data($keys = NULL, $type = 'node') { if (isset($keys)) { if (module_hook($type, 'search_execute')) { $results = module_invoke($type, 'search_execute', $keys); - if (isset($results) && is_array($results) && count($results)) { - if (module_hook($type, 'search_page')) { - return module_invoke($type, 'search_page', $results); - } - else { - return theme('search_results', array('results' => $results, 'type' => $type)); - } + if (module_hook($type, 'search_page')) { + return module_invoke($type, 'search_page', $results); + } + else { + return theme('search_results', array('results' => $results, 'type' => $type)); } } } diff --git a/modules/search/search.pages.inc b/modules/search/search.pages.inc index f0035e0c2..9fce2c591 100644 --- a/modules/search/search.pages.inc +++ b/modules/search/search.pages.inc @@ -35,8 +35,7 @@ function search_view($type = 'node') { $build['search_form'] = drupal_get_form('search_form', NULL, $keys, $type); $build['search_results'] = array( '#theme' => 'search_results_listing', - '#title' => empty($results) ? t('Your search yielded no results') : t('Search results'), - '#content' => empty($results) ? search_help('search#noresults', drupal_help_arg()) : $results, + '#content' => $results, ); return $build; |