Download & Extend

Better hook_menu() implementation

Project:Smackdown
Version:6.x-1.x-dev
Component:Code
Category:task
Priority:normal
Assigned:Scott Reynolds
Status:closed (fixed)

Issue Summary

This here uses a menu loader to verify that its a smackdown node and then passes the access check to the user_access callback.

This makes it so people can menu_alter() this cleanly. And it makes life simpler...

AttachmentSize
smackdown_menu.patch1.45 KB

Comments

#1

doh ! wrong version of the patch. tab root isn't needed here. though its an interesting and important and undocumented part of hook_menu() the menu system will figure out the right root.

AttachmentSize
smackdown_menu.patch 1.42 KB

#2

I still spoke to soon. Instead we can use node_access('view', $node); And this totally works because the object handed to node_access() is a 'node'. Slick...

AttachmentSize
smackdown_menu.patch 1.59 KB

#3

... I failed to motivate this patch completly.

The reason to use a load function over an access function is really simple. If a user types in node/123/voting-results and 123 is not a smackdown node, what is the header you want sent. Access Denied or Page Not Found.

The load function will get you Page Not Found, which is what we want here.

#4

Status:needs review» fixed

committed http://drupal.org/cvs?commit=278840

#5

Status:fixed» closed (fixed)

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

nobody click here