You are here

public function TestForm::buildForm in Google Analytics Event Tracking 8

Same name and namespace in other branches
  1. 8.2 tests/modules/google_analytics_et_test/src/Form/TestForm.php \Drupal\google_analytics_et_test\Form\TestForm::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

tests/modules/google_analytics_et_test/src/Form/TestForm.php, line 23

Class

TestForm
Class TestForm.

Namespace

Drupal\google_analytics_et_test\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['test_radios'] = [
    '#type' => 'radios',
    '#title' => $this
      ->t('Test Radios'),
    '#description' => $this
      ->t('Test radio buttons'),
    '#options' => [
      'one' => $this
        ->t('one'),
      'two' => $this
        ->t('two'),
      'three' => $this
        ->t('three'),
      'four' => $this
        ->t('four'),
    ],
    '#default_value' => 'three',
  ];
  $form['test_select'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Test Select'),
    '#description' => $this
      ->t('Test select'),
    '#options' => [
      'blue' => $this
        ->t('blue'),
      'red' => $this
        ->t('red'),
      'green' => $this
        ->t('green'),
      'yellow' => $this
        ->t('yellow'),
    ],
    '#size' => 5,
    '#default_value' => 'green',
  ];
  $form['test_button'] = [
    '#type' => 'button',
    '#title' => $this
      ->t('Test Button'),
    '#description' => $this
      ->t('Test button'),
    '#value' => $this
      ->t('Click me'),
  ];
  return $form;
}