2

Some forms like the user_login form have $form and &$form_state for parameters. The Drupal 7 Module Development book also have the 2 parameters in their example. But in the Quickstart Guide, the example only have the &$form_state parameter. In what cases should there be 2 parameters and in what cases should there be only 1 parameter?

1

The "Quickstart Guide" you linked to is for Drupal 6.

Drupal 6 form signature:

function MYMODULE_some_form(&$form_state) {
  // ...
}

Drupal 7 form signature:

function MYMODULE_some_form($form, &$form_state) {
  // ...
}

Nothing more to it :)

| improve this answer | |
  • Ok, thanks! What's the link of the Drupal 7 Quickstart Guide? The link in the Drupal 7 Form API Reference leads to the Drupal 6 Quickstart Guide, that's why I initially thought it was just the same. – Pax Apr 24 '13 at 16:03
  • Unless my Google-fu is seriously letting me down there doesn't seem to be an equivalent for Drupal 7...You might start here though, and visit the links on that page they look promising – Clive Apr 24 '13 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.