You are here

public function CountryListForm::buildForm in Country, State and City Fields 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 EntityForm::buildForm

File

src/Form/CountryListForm.php, line 19

Class

CountryListForm
Form controller for the countrylist entity edit forms.

Namespace

Drupal\country_state_city\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {

  /** @var \Drupal\country_state_city\Entity\CountryList $entity */
  $form = parent::buildForm($form, $form_state);
  $entity = $this->entity;
  $form['langcode'] = [
    '#title' => $this
      ->t('Language'),
    '#type' => 'language_select',
    '#default_value' => $entity
      ->language()
      ->getId(),
    '#languages' => Language::STATE_ALL,
    '#access' => TRUE,
  ];
  return $form;
}