using variable in node_add callback
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.
Right know I am getting it from $_GET['q']; is there any other way of doing this? On Mon, Sep 7, 2009 at 1:21 PM, Lluís<enboig@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.
-- *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.
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@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
On Mon, Sep 7, 2009 at 8:06 PM, John Fiala<jcfiala@gmail.com> wrote:
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.
Its not that easy, node_add() expects just the 'node-type', to it don't use any other argument. Thats why I am using $_GET['q'] I want to use my parameter in myNodeType_form($node), which is called by node_add
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@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
-- *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.
Quoting Lluís <enboig@gmail.com>:
On Mon, Sep 7, 2009 at 8:06 PM, John Fiala<jcfiala@gmail.com> wrote:
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.
Its not that easy, node_add() expects just the 'node-type', to it don't use any other argument. Thats why I am using $_GET['q'] I want to use my parameter in myNodeType_form($node), which is called by node_add
The "Druapl Way"(tm) is to use http://api.drupal.org/api/function/arg instead. -- Earnie -- http://r-feed.com/ -- http://for-my-kids.com/ -- http://www.4offer.biz/ -- http://give-me-an-offer.com/
participants (3)
-
Earnie Boyd -
John Fiala -
Lluís