You are here

protected function BoundaryFilter::valueForm in Geolocation Field 8

Same name and namespace in other branches
  1. 8.3 src/Plugin/views/filter/BoundaryFilter.php \Drupal\geolocation\Plugin\views\filter\BoundaryFilter::valueForm()
  2. 8.2 src/Plugin/views/filter/BoundaryFilter.php \Drupal\geolocation\Plugin\views\filter\BoundaryFilter::valueForm()

Options form subform for setting options.

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

Overrides FilterPluginBase::valueForm

See also

buildOptionsForm()

File

src/Plugin/views/filter/BoundaryFilter.php, line 293

Class

BoundaryFilter
Filter handler for search keywords.

Namespace

Drupal\geolocation\Plugin\views\filter

Code

protected function valueForm(&$form, FormStateInterface $form_state) {
  parent::valueForm($form, $form_state);
  $form['value']['#tree'] = TRUE;
  $value_element =& $form['value'];

  // Add the Latitude and Longitude elements.
  $value_element += [
    'lat_north_east' => [
      '#type' => 'textfield',
      '#title' => $this
        ->t('North East Boundary - Latitude'),
      '#default_value' => !empty($this->value['lat_north_east']) ? $this->value['lat_north_east'] : '',
      '#weight' => 10,
    ],
    'lng_north_east' => [
      '#type' => 'textfield',
      '#title' => $this
        ->t('North East Boundary - Longitude'),
      '#default_value' => !empty($this->value['lng_north_east']) ? $this->value['lng_north_east'] : '',
      '#weight' => 20,
    ],
    'lat_south_west' => [
      '#type' => 'textfield',
      '#title' => $this
        ->t('South West Boundary - Latitude'),
      '#default_value' => !empty($this->value['lat_south_west']) ? $this->value['lat_south_west'] : '',
      '#weight' => 30,
    ],
    'lng_south_west' => [
      '#type' => 'textfield',
      '#title' => $this
        ->t('South West Boundary - Longitude'),
      '#default_value' => !empty($this->value['lng_south_west']) ? $this->value['lng_south_west'] : '',
      '#weight' => 40,
    ],
  ];
}