[development] How to add menu entry for certain node type?
Zhang Xiao
xellzhang at gmail.com
Tue Nov 3 01:42:00 UTC 2009
oh... how stupid i am... totally forgot the access callback.... thanks
you very much man!
On Nov 3, 2009, at 8:40 AM, Andrew Berry wrote:
> On 2009-11-02, at 12:25 AM, Zhang Xiao wrote:
>
>> let's say node/456 is not a company node, then there is no tab
>> called "employees" in node 456's page.
>
> Yes, you can do this without much code with CCK and Views. It's
> likely the best solution - if you're new to Drupal, please look at
> those before writing another custom module :). But, that doesn't
> answer the development question of adding a menu tab on nodes of a
> specific content type (which is what Views would do for you
> automatically).
>
> What you want to do is set the 'access callback' and 'access
> arguments' in your hook_menu() implementation. If the node doesn't
> meet the conditions to show the menu tab, return FALSE. signup has a
> nicely documented example; take a look at signup's signup_menu() and
> _signup_menu_access() functions.
>
> --Andrew
More information about the development
mailing list