You are here

public function ProximityFilter::buildOptionsForm in Geolocation Field 8.3

Same name and namespace in other branches
  1. 8 src/Plugin/views/filter/ProximityFilter.php \Drupal\geolocation\Plugin\views\filter\ProximityFilter::buildOptionsForm()
  2. 8.2 src/Plugin/views/filter/ProximityFilter.php \Drupal\geolocation\Plugin\views\filter\ProximityFilter::buildOptionsForm()

Provide the basic form which calls through to subforms. If overridden, it is best to call through to the parent, or to at least make sure all of the functions in this form are called.

Overrides FilterPluginBase::buildOptionsForm

File

src/Plugin/views/filter/ProximityFilter.php, line 78

Class

ProximityFilter
Filter handler for search keywords.

Namespace

Drupal\geolocation\Plugin\views\filter

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $form['unit'] = [
    '#title' => $this
      ->t('Distance unit'),
    '#description' => $this
      ->t('Unit to use for conversion of input value to proximity distance.'),
    '#type' => 'select',
    '#default_value' => $this->options['unit'],
    '#weight' => 6,
    '#options' => [
      'km' => $this
        ->t('Kilometers'),
      'mi' => $this
        ->t('Miles'),
      'nm' => $this
        ->t('Nautical Miles'),
    ],
  ];
  $form['location_input'] = $this->locationInputManager
    ->getOptionsForm($this->options['location_input'], $this);
}