class Date in Drupal 10
Same name in this branch
- 10 core/lib/Drupal/Core/Render/Element/Date.php \Drupal\Core\Render\Element\Date
- 10 core/modules/views/src/Plugin/views/filter/Date.php \Drupal\views\Plugin\views\filter\Date
- 10 core/modules/views/src/Plugin/views/sort/Date.php \Drupal\views\Plugin\views\sort\Date
- 10 core/modules/views/src/Plugin/views/argument/Date.php \Drupal\views\Plugin\views\argument\Date
- 10 core/modules/views/src/Plugin/views/field/Date.php \Drupal\views\Plugin\views\field\Date
- 10 core/modules/datetime/src/Plugin/views/filter/Date.php \Drupal\datetime\Plugin\views\filter\Date
- 10 core/modules/datetime/src/Plugin/views/sort/Date.php \Drupal\datetime\Plugin\views\sort\Date
- 10 core/modules/datetime/src/Plugin/views/argument/Date.php \Drupal\datetime\Plugin\views\argument\Date
Same name and namespace in other branches
- 8 core/modules/datetime/src/Plugin/views/argument/Date.php \Drupal\datetime\Plugin\views\argument\Date
- 9 core/modules/datetime/src/Plugin/views/argument/Date.php \Drupal\datetime\Plugin\views\argument\Date
Abstract argument handler for dates.
Adds an option to set a default argument based on the current date.
Definitions terms:
- many to one: If true, the "many to one" helper will be used.
- invalid input: A string to give to the user for obviously invalid input. This is deprecated in favor of argument validators.
Plugin annotation
@ViewsArgument("datetime");
Hierarchy
- class \Drupal\views\Plugin\views\argument\Formula extends \Drupal\views\Plugin\views\argument\ArgumentPluginBase
- class \Drupal\views\Plugin\views\argument\Date implements ContainerFactoryPluginInterface
- class \Drupal\datetime\Plugin\views\argument\Date uses FieldAPIHandlerTrait
- class \Drupal\views\Plugin\views\argument\Date implements ContainerFactoryPluginInterface
Expanded class hierarchy of Date
See also
\Drupal\views\ManyToOneHelper
23 string references to 'Date'
- Date::getSortName in core/
modules/ views/ src/ Plugin/ views/ argument/ Date.php - Datetime::processDatetime in core/
lib/ Drupal/ Core/ Datetime/ Element/ Datetime.php - Expands a datetime element type into date and/or time elements.
- DateTimeSchemaTest::testDateTimeSchema in core/
modules/ datetime/ tests/ src/ Kernel/ Views/ DateTimeSchemaTest.php - Tests argument plugin schema.
- DbLogController::eventDetails in core/
modules/ dblog/ src/ Controller/ DbLogController.php - Displays details about a specific database log message.
- DbLogController::overview in core/
modules/ dblog/ src/ Controller/ DbLogController.php - Displays a listing of database log messages.
File
- core/
modules/ datetime/ src/ Plugin/ views/ argument/ Date.php, line 27
Namespace
Drupal\datetime\Plugin\views\argumentView source
class Date extends NumericDate {
use FieldAPIHandlerTrait;
/**
* Determines if the timezone offset is calculated.
*
* @var bool
*/
protected $calculateOffset = TRUE;
/**
* {@inheritdoc}
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, RouteMatchInterface $route_match, DateFormatterInterface $date_formatter) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $route_match, $date_formatter);
$definition = $this
->getFieldStorageDefinition();
if ($definition
->getSetting('datetime_type') === DateTimeItem::DATETIME_TYPE_DATE) {
// Timezone offset calculation is not applicable to dates that are stored
// as date-only.
$this->calculateOffset = FALSE;
}
}
/**
* {@inheritdoc}
*/
public function getDateField() {
// Use string date storage/formatting since datetime fields are stored as
// strings rather than UNIX timestamps.
return $this->query
->getDateField("{$this->tableAlias}.{$this->realField}", TRUE, $this->calculateOffset);
}
/**
* {@inheritdoc}
*/
public function getDateFormat($format) {
// Pass in the string-field option.
return $this->query
->getDateFormat($this
->getDateField(), $format, TRUE);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Date:: |
protected | property | The date format used in the query. | 12 |
Date:: |
protected | property | Determines if the timezone offset is calculated. | |
Date:: |
protected | property | The date formatter service. | |
Date:: |
protected | property | The date format used in the title. | 4 |
Date:: |
public | property | ||
Date:: |
protected | property | The route match. | |
Date:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
|
Date:: |
public | function | Add an option to set the default value to the current date. | |
Date:: |
public | function | ||
Date:: |
public | function | ||
Date:: |
public | function | Set the empty argument value to the current date, formatted appropriately for this argument. | |
Date:: |
public | function |
Overrides Formula:: |
|
Date:: |
public | function | ||
Date:: |
public | function |
Constructs a new Date instance. Overrides Date:: |
|
FieldAPIHandlerTrait:: |
protected | property | The entity field manager. | |
FieldAPIHandlerTrait:: |
protected | property | The field definition. | |
FieldAPIHandlerTrait:: |
protected | property | The field storage definition. | |
FieldAPIHandlerTrait:: |
protected | function | Returns the entity field manager. | |
FieldAPIHandlerTrait:: |
protected | function | Gets the field definition. | |
FieldAPIHandlerTrait:: |
protected | function | Gets the field storage configuration. | |
Formula:: |
public | property | ||
Formula:: |
public | function | ||
Formula:: |
public | function | Build the query based upon the formula. | |
Formula:: |
protected | function | Build the summary query based on a formula. |