You are here

public function SearchApiLocationPoint::buildOptionsForm in Search API Location 8

Provide a form to edit options for this plugin.

Overrides ArgumentPluginBase::buildOptionsForm

File

modules/search_api_location_views/src/Plugin/views/argument/SearchApiLocationPoint.php, line 36

Class

SearchApiLocationPoint
Provides a contextual filter for defining a location filter point.

Namespace

Drupal\search_api_location_views\Plugin\views\argument

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  $form['default_radius'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Provide radius default'),
    '#description' => $this
      ->t('Set a default radius for this contextual filter. Even if set, the radius can be overridden with the corresponding "Radius" contextual filter.'),
    '#default_value' => $this->options['default_radius'],
  ];
  $states['visible'][':input[name="options[default_radius]"]']['checked'] = TRUE;
  $form['radius'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Radius'),
    '#description' => $this
      ->t('The radius (in km) around the argument point to set the distance filter.'),
    '#required' => TRUE,
    '#default_value' => $this->options['radius'],
    '#states' => $states,
  ];
  parent::buildOptionsForm($form, $form_state);
}