function FavoriteAnimalTestForm::buildForm

Same name in other branches
  1. 8.9.x 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()
  3. 11.x core/modules/block/tests/modules/block_test/src/Form/FavoriteAnimalTestForm.php \Drupal\block_test\Form\FavoriteAnimalTestForm::buildForm()

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.