You are here

public function ZoneTerritoryTestForm::buildForm in Address 8

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/address_test/src/Form/ZoneTerritoryTestForm.php, line 24

Class

ZoneTerritoryTestForm
Used to test the address_zone_territory form element.

Namespace

Drupal\address_test\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['territory'] = [
    '#type' => 'address_zone_territory',
    '#default_value' => 'AG',
    '#required' => TRUE,
  ];
  $form['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Submit'),
  ];
  return $form;
}