1 form_example_tutorial.inc form_example_tutorial_1($form, &$form_state)

Tutorial Example 1.

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 backdrop_get_form() sends additional arguments, they will be provided after $form_state.

Related topics


modules/examples/form_example/form_example_tutorial.inc, line 49
This is the Form API Tutorial, originally from the Backdrop handbook.


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;