[development] link to issue + solution Re: D7 small survey: listing of node types at/node/add

Moshe Weitzman weitzman at tejasa.com
Wed Dec 5 16:31:18 UTC 2007


Augustin - it is misleading to include 'access' and friends in your  
menu item. They will *NOT* be used. Anyone who relies on them has  
unknowingly compromised their security. You can only inherit whatever  
the original menu item had in 'access'. I think this is clearer:

> $items[] = array('path' => 'node/add',
>      'callback' => 'mymodule_node_add',  // -->> check this line.
> );

On Dec 5, 2007, at 9:39 AM, Augustin (Beginner) wrote:

>
> Well, thinking a bit more about it, I think:
>
> 1) that Gábor 's hint is easy and very useful for D6, and simpler than
> what I sometimes had to do. I'll use that for now.
>
> 2) that there should be an even easier, more drupalish solution for
> D7.
>
> Here is the issue which includes 2 very simple proposals consistent
> with the rest of Drupal:
> http://drupal.org/node/198059
>
>
> On Wednesday 05 December 2007 21:59, Michelle Cox wrote:
>> Unfortunately, what Gábor wrote is greek to me. Do you have time to
>> explain this in a bit more detail?
>
>
> In hook_menu(), create an item that maps node/add to your own function
> callback:
>
>    $items[] = array('path' => 'node/add',
>      'title' => t('Create content'),
>      'callback' => 'mymodule_node_add',  // -->> check this line.
>      'access' => user_access('access content'),
>      'type' => MENU_ITEM_GROUPING,
>      'weight' => 1);
>
> This will override the core callback for node/add.
>
> copy the function node_add() into a new function mymodule_node_add()
> which you can then customize anyway you want.
>
> At least, that's what I understood Gabor's comment to mean.
>
> It's simple and much more flexible than what I did before, but I don't
> like having to copy a whole core function just to remove one item.
>
> Here is a better way for D7:
> http://drupal.org/node/198059
>
>
>
>> PS: I think it's tie to change your nick name.
>
> That's very kind, but I still think it would be a bit premature... ;)
> I often look in awe at what many other members in this list accomplish
> regularly without breaking a sweat!
>
>
> Blessings,
>
> Augustin.
>
>
>
>
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2421 bytes
Desc: not available
Url : http://lists.drupal.org/pipermail/development/attachments/20071205/7a97a885/attachment.bin 


More information about the development mailing list