| 6 form_example_tutorial.inc | form_example_tutorial_1($form_state) |
| 7 form_example_tutorial.inc | form_example_tutorial_1($form, &$form_state) |
| 8 form_example_tutorial.inc | form_example_tutorial_1($form, &$form_state) |
This first form function is from the Form Tutorial handbook page
It just creates a very basic form with a textfield.
This function is called the "form constructor function". It builds the form. It takes a two arguments, $form and $form_state, but if drupal_get_form() sends additional arguments, they will be provided after $form_state.
Related topics
1 string reference to 'form_example_tutorial_1'
File
- form_example/
form_example_tutorial.inc, line 48 - This is the Form API Tutorial from the handbook.
Code
function form_example_tutorial_1($form, &$form_state) {
$form['description'] = array(
'#type' => 'item',
'#title' => t('A form with nothing but a textfield'),
);
// This is the first form element. It's a textfield with a label, "Name"
$form['name'] = array(
'#type' => 'textfield',
'#title' => t('Name'),
);
return $form;
}
Login or register to post comments