You are here

public function FavoriteAnimalTestForm::buildForm in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/block/tests/modules/block_test/src/Form/FavoriteAnimalTestForm.php \Drupal\block_test\Form\FavoriteAnimalTestForm::buildForm()
  2. 10 core/modules/block/tests/modules/block_test/src/Form/FavoriteAnimalTestForm.php \Drupal\block_test\Form\FavoriteAnimalTestForm::buildForm()

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides FormInterface::buildForm

File

core/modules/block/tests/modules/block_test/src/Form/FavoriteAnimalTestForm.php, line 25

Class

FavoriteAnimalTestForm
Form that performs favorite animal test.

Namespace

Drupal\block_test\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['favorite_animal'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Your favorite animal.'),
  ];
  $form['submit_animal'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Submit your chosen animal'),
  ];
  return $form;
}