function piwik_preprocess_search_results in Piwik Web Analytics 7.2
Same name and namespace in other branches
- 6.2 piwik.module \piwik_preprocess_search_results()
Implements hook_preprocess_search_results().
Collects and adds the number of search results to the head.
File
- ./
piwik.module, line 466 - Drupal Module: Piwik
Code
function piwik_preprocess_search_results(&$variables) {
// There is no search result $variable available that hold the number of items
// found. But the pager item mumber can tell the number of search results.
global $pager_total_items;
drupal_add_js('window.piwik_search_results = ' . intval($pager_total_items[0]) . ';', array(
'type' => 'inline',
'group' => JS_LIBRARY - 1,
));
}