You are here

public function Date::buildOptionsForm in Views XML Backend 8

Same name in this branch
  1. 8 src/Plugin/views/filter/Date.php \Drupal\views_xml_backend\Plugin\views\filter\Date::buildOptionsForm()
  2. 8 src/Plugin/views/argument/Date.php \Drupal\views_xml_backend\Plugin\views\argument\Date::buildOptionsForm()
  3. 8 src/Plugin/views/field/Date.php \Drupal\views_xml_backend\Plugin\views\field\Date::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/Date.php, line 58
Contains \Drupal\views_xml_backend\Plugin\views\filter\Date.

Class

Date
Date filter implementation.

Namespace

Drupal\views_xml_backend\Plugin\views\filter

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  $form['xpath_selector'] = [
    '#type' => 'textfield',
    '#title' => 'XPath selector',
    '#description' => $this
      ->t('The field name in the table that will be used as the filter.'),
    '#default_value' => $this->options['xpath_selector'],
    '#required' => TRUE,
  ];
  $form['granularity'] = [
    '#type' => 'radios',
    '#title' => $this
      ->t('Granularity'),
    '#options' => [
      'second' => $this
        ->t('Second'),
      'minute' => $this
        ->t('Minute'),
      'hour' => $this
        ->t('Hour'),
      'day' => $this
        ->t('Day'),
      'month' => $this
        ->t('Month'),
      'year' => $this
        ->t('Year'),
    ],
    '#description' => $this
      ->t('The granularity is the smallest unit to use when determining whether two dates are the same; for example, if the granularity is "Year" then all dates in 1999, regardless of when they fall in 1999, will be considered the same date.'),
    '#default_value' => $this->options['granularity'],
  ];
  parent::buildOptionsForm($form, $form_state);
}