Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Date.php

function 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 111

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal