function Date::defaultArgumentForm

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/argument/Date.php \Drupal\views\Plugin\views\argument\Date::defaultArgumentForm()
  2. 8.9.x core/modules/views/src/Plugin/views/argument/Date.php \Drupal\views\Plugin\views\argument\Date::defaultArgumentForm()
  3. 11.x 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 115

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"),
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.