0

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.

3
  • Is any content loaded with AJAX? Feb 9, 2016 at 6:21
  • Yes. Though, not with anything to do with that path 'current-player'.
    – Christian
    Feb 9, 2016 at 6:24
  • 1
    Perhaps something in the "current-player" path is doing an AJAX callback that loads the player block or page with that block in it, or maybe the server is somehow seeing the redirect path as the current path. arg() uses $_GET['q'] which can be an AJAX callback. Also, maybe worth including your full hook_block_view and the other module hook_menu code to debug. Feb 9, 2016 at 6:40

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.