function NodeDateArgumentDefaultPluginBase::getArgument
Return the default argument.
This needs to be overridden by every default argument handler to properly do what is needed.
Overrides ArgumentDefaultPluginBase::getArgument
File
-
core/
modules/ node/ src/ Plugin/ views/ argument_default/ NodeDateArgumentDefaultPluginBase.php, line 53
Class
- NodeDateArgumentDefaultPluginBase
- Provides a base class for node date values.
Namespace
Drupal\node\Plugin\views\argument_defaultCode
public function getArgument() : string|bool {
// Return a time value from the current node if available.
if (($node = $this->routeMatch
->getParameter('node')) && $node instanceof NodeInterface) {
// The Date argument handlers provide their own format strings, otherwise
// use a default.
$format = $this->argument instanceof Date ? $this->argument
->getArgFormat() : 'Y-m-d';
return $this->dateFormatter
->format($this->getNodeDateValue($node), 'custom', $format);
}
return FALSE;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.