Routing Debug is a simple module that provides menu routing table with additional information like:

  • name of the callback function,
  • filename and path of file where the callback is defined,
  • line number of function definition.

Intention of the module is to help developer to identify potential menu overrides. Module interface is accessible on /routing_debug URL.

Project sandbox page: https://www.drupal.org/sandbox/david.lukac/2479685.

Git clone command: git clone --branch 7.x-1.x http://git.drupal.org/sandbox/david.lukac/2479685.git routing_debug.

About author: David Lukac is a senior IT consultant and analyst with experience and background in large enterprise Java/J2EE projects in telecommunication sector, system integration and CRM. He's been working with Drupal since 2009 as CTO of Mogdesign.eu, joining iKOS Digital in 2014 as senior Technical Consultant. David has finally found time to do more development due to his position change to less executive and more technical :-). Author is also co-founder of DrupalFund crowdfunding platform for Drupal related projects.

CommentFileSizeAuthor
#13 routing_debug-permission-2484543-13.patch488 bytesm1n0

Comments

david.lukac’s picture

Issue summary: View changes
ayesh’s picture

Hello there,
Could you explain how exactly this module is different from the Admin_menu module-provided admin_devel module?

When you enable asmin_devel, you get an additional set of debug tools, including a menu router info tool. There's no Reflection that gives the exact file and line name, but gives everything else I can see this module is showing.

PA robot’s picture

Status: Needs review » Needs work

There are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxdavidlukac2479685git

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

david.lukac’s picture

Hi Ayesh, do you mean 'Menu Item' feature from devel (i.e. /devel/menu/item?path=admin/config/development/devel)?

That one provides info about one menu item, but changeable only via URL (not really user friendly). It doesn't provide list of all registered routes/paths. Also it doesn't list module which has registered given route. It usually doesn't include 'include' file. Additionally when callback is 'drupal_get_form', the 'real' callback is hidden in different field of the array.

According to contents of 'admin_devel.module' it provides only 'rebuild menu links' functionality :-\.

I believe Routing Debug provides more useful interface when trying to deal with e.g. overridden routes. Of course it would be great if it could be merged into devel in future.

Thanks for the review! :-)

david.lukac’s picture

Status: Needs work » Needs review

Fixed some of the too long lines in README and CHANGELOG files. Not all can be fixed though (e.g. release headline: [Routing Debug - v0.0.1 (2015-04-28)](https://github.com/davidlukac/routing_debug/releases/tag/v0.0.1) - markdown will break if it's split by a new line).

Another warning is for usage of kprint_r on the 'debug' page, but I couldn't find better replacement for it, so if anyone can advise, I'll appreciate it.

ayesh’s picture

I'm not reviewing project applications to get a review bonus, and I'm merely helping Klausi and other admins to keep the queues clean. Sorry for popping questions/doubts this way. I'm just providing my feedback with hope to speed up the process.

I think the Devel + admin_devel approach is there because you do not have to load all the files in order to extract the menu item data. Devel module is already designed for developers, so I think providing the router path from URL is not a big UX issue.

admin_menu is a really active module, so I would rather try to add the function line features and other drupal_get_form() extras into the admin menu module itself. You can still get the vetted status and of course get attribution set to your account.

Either way, note that drupal_get_form()'s first argument is usually a function name, but not always. Modules can implement hook_forms() to get called for form IDs that do not have a matching function name.

david.lukac’s picture

Hi Ayesh,

I absolutely appreciate your feedback :-). I will definitely take the advice and try to get the module or it's interface merged either devel or admin_devel module, but that might be a longer discussion and process with their maintainers (and having the module already published would definitely help).

I still believe though, that Routing Debug module provides added value in addition to /devel/menu/item?path..., e.g. for junior developers or developers coming from other systems (e.g. Symfony2 provides similar routing info page); this info might be also useful for people customising more complex install profiles, like OpenAtrium (which defines lots of paths and many of them are overridden by multiple modules) and these people might not necessarily be senior developers. People who already know the paths (and don't need their list) and can read output of /devel/menu/item, probably don't need either of the modules :-). Now that I'm thinking of it, I'll add a link to /devel/menu/item from the routes listed in Routing Debug.

Are there any other particular reasons I should work on, that could potentially prevent publishing the module?

Thanks again for your feedback and work, I really appreciate it!

david.lukac’s picture

Issue summary: View changes
david.lukac’s picture

I have added link to 'devel/menu/item' and actual page of the route (if it passes validity test) for each listed route.

david.lukac’s picture

New feature: I have added a block that prints debug information for current path - routing_debug-block.

m1n0’s picture

Status: Needs review » Needs work

Hi, this seems like a handy dev module, I think all those small things + the debug block you just added are enough for a separate module to make sense. Quick look at the code gave me an impression of a very clean code, so there seems to be no issue from that point of view. One suggestion though - I would expect to see the provided menu links somewhere in the admin menu, perhaps under Reports - this would also switch your gui to use administration theme (if the site uses it) which copes much better with the wide table you provide (URLs would change to e.g. "admin/reports/routing_debug")

Some very minor suggestions which you might completely ignore:
- I like very verbose comments, but putting in comments like "We just define our block here; it's actual contents is being provided by hook_block_view() function." for one of the most widely known and used hooks does not seem necessary - I would rather state here what the defined block(s) is for. Same goes for "hook_block_view", I havent noticed more of these.
- _routing_debug_block_contents() - you use escaped single quotes to display them - why not use double quotes instead? Escaping quotes for such reason seems unnecessarily confusing to me - also, double quotes on front end in texts seems more natural to me than single ones (might be just me though)

More comments to come if required :)

m1n0’s picture

Additionally, you use "access routing information" as access argument for the menu items, with no access callback defined - which means default user_access is used - but I do not see "access routing information" permission defined anywhere. This way no one but user 1 can access these menu links.

m1n0’s picture

StatusFileSize
new488 bytes

I was bored so here is the permission hook patch :).

ayesh’s picture

Hi again,
I don't think there are anymore blockers in the code, but here are a few suggestions.

- In the .module file, you include the admin and pages.inc file, which you don't really have to. In the hook_menu() implementation, you can define the file to load, so they won't be loaded on every page; just when the user tries to access the page. I'm kinda feeling silly for saying this to you now that you have written a module to debug routers themselves. If there's any reason to include them on any page, please disregard my note.

- Can we capitalize the first word of list items (.module:88...90)

- In the .module:230, make sure there is no double encoding. url() function can do the urlenode() call for you for parameters passed in the 'query' array for the second parameter.

- .module:234: Please use the t() function to wrap the string literals.

- I also agree with Milan (m1n0) about code commenting. Beautifully commented! The @var commenting is just candy to IDEs. Really great work. In the RoutingInfo class, you could define the describe class properties in the @property syntax on the root comment. It would look much cleaner.

None of the above suggestions are not blockers. I'm not going to override m1n0's "Needs work" here, but I think this is pretty much RTBC now.

m1n0’s picture

I think the only blocker is the permission thing, as that is actually a bug.

ayesh’s picture

Sorry, yes you are right about the permission issue. Oh look we have a patch too!

david.lukac’s picture

Status: Needs work » Needs review

Gentlemen, thanks for reviews, and for the patch, much appreciated!

  • I have included link to the main page of the module under Reports -> Routing Debug section,
  • I have also added module links under Development section, where Devel links are (which makes a lot of sense to me),
  • documentation was updated accordingly to the new paths,
  • I have added more specific information to the mentioned comments :-),
  • single quotes + escaped single quotes are now changed to double quotes + single quotes (that was just silly, originally it was written without the escaped ones, those were added later),
  • I have incorporated the patch and added the permission,
  • additionally I have applied the permission when rendering the block (it's rendered only when user has permission granted),
  • I have moved the includes to each menu item separately,
  • first letters in the list (hook_help) capitalised,
  • unnecessary encoding was removed,
  • block contents/markup is made translateable,
  • I have added some class documentation as suggested, but couldn't figure out what exactly is the correct form (@var takes precedence in IDE anyways).

Hopefully now the module ready to go and see the world! :-)

ayesh’s picture

Are you sure you pushed the code?

ayesh’s picture

Also, please note there is a minor change necessary with your git strategy to match the drupal.org module packaging system.

For each major Drupal core version, we create a branch. 7.x-1.x, 8.x-1.x, likewise. If the module has major version for each Drupal major version, they can be named like 7.x-1.x, 7.x-2.x, likewise.

However, we do not create a branch for each release. The branch is supposed to be the latest HEAD, and when you are ready to release a version, you can add a tag to that commit. 7.x-1.0, 7.x-1.1.
This format is expected by the d.o packaging system and Drupal itself (in update checks, etc).

david.lukac’s picture

I'm sorry for the delay - wanted to make sure that Milan gets contribution for his patch, which I realised just after posting last comment.

david.lukac’s picture

Issue summary: View changes
david.lukac’s picture

As for the branching strategy - after reading "Release naming conventions" and "Creating a project release", I have renamed branch 7.x-1.x-rc to 7.x-1.x and created tag 7.x-1.0-rc1. Hopefully I got it right :-). 'Internally' I use GitFlow and I don't see a reason to change that as long as I keep branch/tag conventions for public releases.

ayesh’s picture

Thanks. Module looks quite ready to me, so I'll go ahead and RTBC. I still think you could go for a Review Bonus, so Klausi or some other git admin can take a look at this application quickly.

ayesh’s picture

Status: Needs review » Reviewed & tested by the community
ayesh’s picture

Sorry about the delay in this, and thank you for co-operation during the review process. I will go ahead and mark this account as vetted. This is by the way, my first module that I'm approving after becoming a git admin.

Thanks for your contribution, David Lukac!

I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Thanks to the dedicated reviewer(s) as well.

ayesh’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.