At the moment I am trying to force "current language" onto the list of the options passed into node_search_execute. Unfortunately I'm having trouble finding the right place to put the function hooks. Perhaps I am missing something simple.
I've got myself down to two basic possibilities for how this should be implemented.
(1) Implement hook_search_info
and hook_search_execute
In this case, I'd copy the code from node_search_execute
and add a line to it that adds "AND Language = '$current_language'" to the search query.
In my theme folder I've tried adding the functions mythemename_search_info
and mythemename_search_execute
- but they do not execute. When run.
function mythemename_search_info() {
return array(
'title' => 'Content',
'path' => 'node',
'conditions_callback' => 'mythemename_search_execute',
);
}
function mythemename_search_execute($keys = NULL, $conditions = NULL){
return array();
}
In this example - I'd just hope to get "no results" so I could be sure the override was running, then I'd implement the full search functionality.
(2) Implement hook_search_preprocess()
I also tried mythemename_search_preprocess()
function mythemename_search_preprocess($text) {
// Do processing on $text
echo $text; die();
$text = "french";
return $text;
}
But again, I don't get the expected results (a white page with a bit of text on it)
So whatever I'm doing, these search hooks are not getting detected.
What's missing? Do they perhaps have to be in a module?