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

mallet’s picture

anyone? I am still struggling to find out what I am doing wrong :(

-mallet

avpaderno’s picture

The $callbacks variable contains the definition of the menu callbacks like returned from the implementations of hook_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

mallet’s picture

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

avpaderno’s picture

The $callbacks array is the same array used to describe the menu of a module in the implementation of hook_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