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

Augustin (Beginner) drupal.beginner at wechange.org
Wed Dec 5 14:39:56 UTC 2007


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.



 



More information about the development mailing list