You are here

public function AdministrativeArea::valueForm in Address 8

Options form subform for setting options.

This should be overridden by all child classes and it must define $form['value']

Overrides InOperator::valueForm

See also

buildOptionsForm()

1 call to AdministrativeArea::valueForm()
AdministrativeArea::showValueForm in src/Plugin/views/filter/AdministrativeArea.php
Shortcut to display the value form.

File

src/Plugin/views/filter/AdministrativeArea.php, line 364

Class

AdministrativeArea
Filter by administrative area.

Namespace

Drupal\address\Plugin\views\filter

Code

public function valueForm(&$form, FormStateInterface $form_state) {
  $this->valueOptions = [];
  $this->formState = $form_state;
  $country_source = $this
    ->getCountrySource();
  if ($country_source == 'static' || $form_state
    ->get('exposed')) {
    $this
      ->getCurrentCountry();
    parent::valueForm($form, $form_state);
    $form['value']['#after_build'][] = [
      get_class($this),
      'clearValues',
    ];
  }
  else {
    $form['value'] = [
      '#type' => 'container',
      '#attributes' => [
        'id' => 'admin-area-value-options-ajax-wrapper',
      ],
    ];
    $form['value']['message'] = [
      '#type' => 'markup',
      '#markup' => $this
        ->t("You can only select options here if you use a predefined country for the 'Country source'."),
    ];
  }
}