You are here

public function Date::defaultArgumentForm in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/argument/Date.php \Drupal\views\Plugin\views\argument\Date::defaultArgumentForm()

Add an option to set the default value to the current date.

Overrides ArgumentPluginBase::defaultArgumentForm

File

core/modules/views/src/Plugin/views/argument/Date.php, line 97

Class

Date
Argument handler for dates.

Namespace

Drupal\views\Plugin\views\argument

Code

public function defaultArgumentForm(&$form, FormStateInterface $form_state) {
  parent::defaultArgumentForm($form, $form_state);
  $form['default_argument_type']['#options'] += [
    'date' => $this
      ->t('Current date'),
  ];
  $form['default_argument_type']['#options'] += [
    'node_created' => $this
      ->t("Current node's creation time"),
  ];
  $form['default_argument_type']['#options'] += [
    'node_changed' => $this
      ->t("Current node's update time"),
  ];
}