By mallet on
I am trying to replace drupals core search with my own views search. And I am finding it very hard to implement.
The views search I created works fine but only if you go to its exact views url path does it work.
I used the function hook_menu_alter to replace the drupal core search with my views search path
The furthest Iam getting is, enabling the module. the search page still display the original drupal results page. and sometimes it says access denied.
Here is my code in the module file:
function searchy_perm() {
return array('access searchy', 'administer searchy');
} // function searchy_perm
function searchy_menu_alter(&$callbacks) {
// Example - disable the page at node/add
$callbacks['search/node']['mynameofview'] = FALSE;
}
is this even the right method of replacing the core search?
Comments
anyone? I am still
anyone? I am still struggling to find out what I am doing wrong :(
-mallet
$callbacks['search/node']['mynameofview'] is wrong
The
$callbacksvariable contains the definition of the menu callbacks like returned from the implementations ofhook_menu().I am not sure what you are trying to do with that line, but Drupal doesn't handle an array key like
'mynameofview'.The array passed contains the same array keys as described in
hook_menu()documentation.-- Kiam
Kiam la luno renkontas la sunon
thanks for the reply :)
thanks for the reply :)
can you please give me an example to what I should put in my callback?
the reason why I put the array as: $callbacks['search/node']['mynameofview'] was because it was mention here on drupals api example:
http://api.drupal.org/api/function/hook_menu_alter
-Mallet
It's the same array used to describe the menu of a module
The
$callbacksarray is the same array used to describe the menu of a module in the implementation ofhook_menu(). If you already done that, then you know what to do.The array key you describe (
'mynameofview') doesn't make any sense for Drupal.-- Kiam
Kiam la luno renkontas la sunon