Skip to content

Instantly share code, notes, and snippets.

@sanguis
Created April 25, 2012 20:37
Show Gist options
  • Save sanguis/2493155 to your computer and use it in GitHub Desktop.
Save sanguis/2493155 to your computer and use it in GitHub Desktop.
search term and count
<?php
function search_tc_menu_alter(&$items) {
$items['search']['title callback'] = 'search_tc_title';
}
function search_tc_title($title) {
global $pager_total_items;
if ($pager_total_items[0] > 0) {
return t('!count search results for &#8220;!term&#8221;', array('!count' => $pager_total_items[0], '!term' => SEARCH_TERM));
}
else {
return t("Search");
}
}
function search_tc_form_search_form_alter(&$form, &$form_state, $form_id) {
define('SEARCH_TERM', $form_state['build_info']['args'][1]);
}
@sanguis
Copy link
Author

sanguis commented Apr 27, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment