So, I have a module with a very plain hook_block_view
in it. The hook contains definitions for around 12 blocks.
If I var_dump(arg())
at the top of the hook and load a page with 3 or 4 of these blocks, I see something odd;
array (size=2)
0 => string 'node' (length=4)
1 => string '67739' (length=5)
array (size=2)
0 => string 'node' (length=4)
1 => string '67739' (length=5)
array (size=1)
0 => string 'current-player' (length=14)
The same happens for menu_get_object()
, I get node object, node object, then null
.
The path 'current-player' is defined in another modules hook_menu and is simply a redirect to the page I'm on with these blocks.
Why, on the same page, would hook_block_view have different results for arg() and menu_get_object? I can confirm that the page path has not changed, it remains the same for the load.
arg()
uses$_GET['q']
which can be an AJAX callback. Also, maybe worth including your fullhook_block_view
and the other modulehook_menu
code to debug.