5

Every now and then, mostly when looking at a new site, I find myself wanting to know

What's the source of this particular page?

Usually, I end up starting to dig in the menu_router table, and possibly also alias tables. Is there a module that will be helpful in finding and displaying this, and other relevant, information for me?

  • What information about the route/aliases are you looking to display? Page callback/arguments, access callback/arguments, etc...? – Clive Jun 19 '13 at 10:11
  • The information I've found myself looking for repeatedly is the page callback, and sometimes, because it's aliased, that requires finding the current URL I'm looking at among the aliases. But if a module is able to dig out the hook_menu item, then having all of it displayed would make sense I guess. :) – Letharion Jun 19 '13 at 10:29
  • It probably wouldn't be a terribly complex module to write myself, I just don't want to spend the effort if someone's already done it. It could even be that devel can do it and I've never noticed. – Letharion Jun 19 '13 at 10:34
4

I'm not sure there's a module specifically for that, if anything I think it would come under the domain of Devel as you mentioned in the comments. I haven't seen anything like that in Devel before though.

Getting the router item for the current path itself is very easy:

$item = menu_get_item();
$callback = $item['page callback'];
// etc...

You could just wrap that in a hook_init() and dpm() it out for a quick solution, or maybe build a patch up for Devel.

|improve this answer|||||
  • Oh, cool. I didn't know about menu_get_item()! :) – Letharion Jun 19 '13 at 15:00
  • 1
    Me neither...I started typing menu_ in my IDE's autocomplete and let it tell me what to do ;) Now if I could only train it to write all my code for me... – Clive Jun 19 '13 at 15:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.