You are here

public function Date::buildOptionsForm in Views (for Drupal 7) 8.3

Same name in this branch
  1. 8.3 lib/Drupal/views/Plugin/views/sort/Date.php \Drupal\views\Plugin\views\sort\Date::buildOptionsForm()
  2. 8.3 lib/Drupal/views/Plugin/views/field/Date.php \Drupal\views\Plugin\views\field\Date::buildOptionsForm()

Basic options for all sort criteria

Overrides SortPluginBase::buildOptionsForm

File

lib/Drupal/views/Plugin/views/sort/Date.php, line 32
Definition of Drupal\views\Plugin\views\sort\Date.

Class

Date
Basic sort handler for dates.

Namespace

Drupal\views\Plugin\views\sort

Code

public function buildOptionsForm(&$form, &$form_state) {
  parent::buildOptionsForm($form, $form_state);
  $form['granularity'] = array(
    '#type' => 'radios',
    '#title' => t('Granularity'),
    '#options' => array(
      'second' => t('Second'),
      'minute' => t('Minute'),
      'hour' => t('Hour'),
      'day' => t('Day'),
      'month' => t('Month'),
      'year' => t('Year'),
    ),
    '#description' => 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'],
  );
}