I have a module where hook_menu() was already used to process ajax calls, like this:
function bizaudit_menu() {
return [
'bizaudit/ajax' => [
'page callback' => '_bizaudit_ajax_handle',
'access arguments' => ['access content'],
'type' => MENU_CALLBACK,
],
'bizaudit/autoexec' => [
'page callback' => '_bizaudit_autoexec_handle',
'access arguments' => ['access content'],
'type' => MENU_CALLBACK,
],
];
}
That works pretty well from times, then I just added another item, now to handle some precise route, like this:
function bizaudit_menu() {
return [
'bizaudit/ajax' => [
'page callback' => '_bizaudit_ajax_handle',
'access arguments' => ['access content'],
'type' => MENU_CALLBACK,
],
'bizaudit/autoexec' => [
'page callback' => '_bizaudit_autoexec_handle',
'access arguments' => ['access content'],
'type' => MENU_CALLBACK,
],
'navigate' => [
'page callback' => '_bizaudit_navigate_handle',
'access arguments' => ['access content'],
'type' => MENU_CALLBACK,
],
];
}
But this route seems to be never recognized!
To be sure I changed the callback function like this:
function _bizaudit_navigate_handle() {
$query_params = drupal_get_query_parameters();
echo implode('<br>', print_r($query_params, true));
exit;
}
Using this url 127.0.0.1/apim/navigate
should cause the query params to be printed (here empty, but no matter), and nothing else to happen.
Instead I get the normal content of the involved page displayed!
(I didn't omit to clear the cache)
Maybe I'm missing someting obvious?
hook_menu()
, where I would do some stuff before redirecting to the normal url (without the special query params). Would it be thathook_menu()
never works if the stated item is a real page? – cFreed Sep 12 '19 at 12:38