You are here

public function AdministrativeArea::submitExposeForm in Address 8

Perform any necessary changes to the form exposes prior to storage. There is no need for this function to actually store the data.

Overrides HandlerBase::submitExposeForm

File

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

Class

AdministrativeArea
Filter by administrative area.

Namespace

Drupal\address\Plugin\views\filter

Code

public function submitExposeForm($form, FormStateInterface $form_state) {

  // If the country source is anything other than static, we have to
  // ignore/disable the "reduce" option since it doesn't make any sense and
  // will cause problems if the stale configuration is saved.
  // Similarly, we clear out any selections for specific administrative areas.
  $country_source = $form_state
    ->getValue([
    'options',
    'country',
    'country_source',
  ]);
  if ($country_source != 'static') {
    $form_state
      ->setValue([
      'options',
      'expose',
      'reduce',
    ], FALSE);
    $form_state
      ->setValue([
      'options',
      'value',
    ], []);
  }
  parent::submitExposeForm($form, $form_state);
}