I am using drupal 7. I have a link which goes to href="/mod/filter/1"
<a href="/mod/filter/1">X</a>
and i have a a hook_menu
function mod_menu () {
$menu = array(
'mod/filter/%' => array (
"title" => "Bare HTML for use in ajax.",
"page callback" => "mod_remove_filter_function",
"page arguments" => array(1),
"type" => MENU_CALLBACK,
)
);
return $menu;
}
Then the callback function
function mod_remove_filter_function($arg){
dsm('call back filter');
drupal_goto('/res/search');
}
To me this should work, It is the first time i've used the menu hook but this looks like it should work according to the documentation given.
Any ideas why is doesn't work?
function mod_menu () {
$menu = array(
'mod/filter/%' => array (
"title" => "Bare HTML for use in ajax.",
"page callback" => "mod_remove_filter_function",
"page arguments" => array(1),
"type" => MENU_CALLBACK,
)
);
return $menu;
}
hook is workds perfect. problem might be in the callback function dsm function requires devel module and if you are using the drupal_goto('/res/search'); check for the "/res/search" path first .
:)
here is how I use hook_menu in custom modules.
$menu['mod/filter/%'] = array(
'title'=>t('look this is title'),
'page callback' => 'mod_remove_filter_function',
'access callback' => 'user_access',
'access arguments' => array('access_contents'),
'type' => MENU_NORMAL_ITEM,
);