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/sort/Date.php \Drupal\datetime\Plugin\views\sort\Date
- 9 core/modules/datetime/src/Plugin/views/sort/Date.php \Drupal\datetime\Plugin\views\sort\Date
Basic sort handler for datetime fields.
This handler enables granularity, which is the ability to make dates equivalent based upon nearness.
Plugin annotation
@ViewsSort("datetime");
Hierarchy
- class \Drupal\views\Plugin\views\sort\SortPluginBase extends \Drupal\views\Plugin\views\HandlerBase implements CacheableDependencyInterface
- class \Drupal\views\Plugin\views\sort\Date
- class \Drupal\datetime\Plugin\views\sort\Date uses FieldAPIHandlerTrait
- class \Drupal\views\Plugin\views\sort\Date
Expanded class hierarchy of Date
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/ sort/ Date.php, line 17
Namespace
Drupal\datetime\Plugin\views\sortView 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) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$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}
*
* Override to account for dates stored as strings.
*/
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}
*
* Overridden in order to pass in the string date flag.
*/
public function getDateFormat($format) {
return $this->query
->getDateFormat($this
->getDateField(), $format, TRUE);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Date:: |
protected | property | Determines if the timezone offset is calculated. | |
Date:: |
public | function |
Basic options for all sort criteria. Overrides SortPluginBase:: |
|
Date:: |
protected | function |
Overrides SortPluginBase:: |
|
Date:: |
public | function | Override to account for dates stored as strings. | |
Date:: |
public | function | Overridden in order to pass in the string date flag. | |
Date:: |
public | function |
Called to add the sort to a query. Overrides SortPluginBase:: |
1 |
Date:: |
public | function | ||
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. | |
SortPluginBase:: |
public | function | Display whether or not the sort order is ascending or descending. | |
SortPluginBase:: |
public | function | ||
SortPluginBase:: |
public | function | Determine if a sort can be exposed. | |
SortPluginBase:: |
public | function | Provide default options for exposed sorts. | |
SortPluginBase:: |
public | function |
The cache contexts associated with this object. Overrides CacheableDependencyInterface:: |
|
SortPluginBase:: |
public | function |
The maximum age for which this object may be cached. Overrides CacheableDependencyInterface:: |
|
SortPluginBase:: |
public | function |
The cache tags associated with this object. Overrides CacheableDependencyInterface:: |
|
SortPluginBase:: |
public | function | Shortcut to display the expose/hide button. | |
SortPluginBase:: |
protected | function | Shortcut to display the value form. | |
SortPluginBase:: |
protected | function | Provide a list of options for the default sort form. | |
SortPluginBase:: |
public | function | ||
SortPluginBase:: |
protected | function | ||
SortPluginBase:: |
public | function | Simple submit handler. | |
SortPluginBase:: |
public static | function | ||
SortPluginBase:: |
public | function | Validate the options form. | |
SortPluginBase:: |
public | function | Simple validate handler. |