[development] using variable in node_add callback

John Fiala jcfiala at gmail.com
Mon Sep 7 18:06:31 UTC 2009


It's not that hard, actually.  Just change the 'page arguments' to
include the value 1.  That means that the value in the 1st segment of
the url will be passed in as the argument there, and since we (like
good computer scientists) start counting at 0, that means the %-value
will be passed to the node_add function.

You might want to read up on http://drupal.org/node/209056 and the
sibling pages to it.

On Mon, Sep 7, 2009 at 5:21 AM, Lluís<enboig at gmail.com> wrote:
> I have added a menu to insert nodes but I need use %variable inside
> node_form; how could I achieve this?
>
>  $items['node/%/pressupost/afegir'] = array(
>    'title' => 'afegeix', //trans
>    'access callback' => 'cc_projects_isProject',
>    'access arguments' => array(1,'create pressupost'),
>    'type' => MENU_LOCAL_TASK,
>    'weight' => 10,
>    'page callback' => 'node_add',
>    'page arguments' => array('cc_pressupost'),
>    'file' => 'node.pages.inc',
>    'file path' => drupal_get_path('module', 'node'),
>  );
>
> thanks
>
>
> --
> *La vida és com una taronja, què esperes a exprimir-la?
> *Si creus que l'educació és cara, prova la ignorància.
> *La vida és com una moneda, la pots gastar en el que vulguis però
> només una vegada.
> *Abans d'imprimir aquest missatge, pensa en el medi ambient.
>



-- 
John Fiala


More information about the development mailing list