public function Date::getDefaultArgument in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/views/src/Plugin/views/argument/Date.php \Drupal\views\Plugin\views\argument\Date::getDefaultArgument()
Set the empty argument value to the current date, formatted appropriately for this argument.
Overrides ArgumentPluginBase::getDefaultArgument
File
- core/
modules/ views/ src/ Plugin/ views/ argument/ Date.php, line 102 - Contains \Drupal\views\Plugin\views\argument\Date.
Class
- Date
- Abstract argument handler for dates.
Namespace
Drupal\views\Plugin\views\argumentCode
public function getDefaultArgument($raw = FALSE) {
if (!$raw && $this->options['default_argument_type'] == 'date') {
return date($this->argFormat, REQUEST_TIME);
}
elseif (!$raw && in_array($this->options['default_argument_type'], array(
'node_created',
'node_changed',
))) {
$node = $this->routeMatch
->getParameter('node');
if (!$node instanceof NodeInterface) {
return parent::getDefaultArgument();
}
elseif ($this->options['default_argument_type'] == 'node_created') {
return date($this->argFormat, $node
->getCreatedTime());
}
elseif ($this->options['default_argument_type'] == 'node_changed') {
return date($this->argFormat, $node
->getChangedTime());
}
}
return parent::getDefaultArgument($raw);
}