protected function DateTimeFormatterBase::buildDate in Drupal 9
Same name and namespace in other branches
- 8 core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeFormatterBase.php \Drupal\datetime\Plugin\Field\FieldFormatter\DateTimeFormatterBase::buildDate()
- 10 core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeFormatterBase.php \Drupal\datetime\Plugin\Field\FieldFormatter\DateTimeFormatterBase::buildDate()
Creates a render array from a date object.
Parameters
\Drupal\Core\Datetime\DrupalDateTime $date: A date object.
Return value
array A render array.
4 calls to DateTimeFormatterBase::buildDate()
- DateRangeCustomFormatter::viewElements in core/
modules/ datetime_range/ src/ Plugin/ Field/ FieldFormatter/ DateRangeCustomFormatter.php - Builds a renderable array for a field value.
- DateRangePlainFormatter::viewElements in core/
modules/ datetime_range/ src/ Plugin/ Field/ FieldFormatter/ DateRangePlainFormatter.php - Builds a renderable array for a field value.
- DateTimeCustomFormatter::viewElements in core/
modules/ datetime/ src/ Plugin/ Field/ FieldFormatter/ DateTimeCustomFormatter.php - Builds a renderable array for a field value.
- DateTimePlainFormatter::viewElements in core/
modules/ datetime/ src/ Plugin/ Field/ FieldFormatter/ DateTimePlainFormatter.php - Builds a renderable array for a field value.
File
- core/
modules/ datetime/ src/ Plugin/ Field/ FieldFormatter/ DateTimeFormatterBase.php, line 201
Class
- DateTimeFormatterBase
- Base class for 'DateTime Field formatter' plugin implementations.
Namespace
Drupal\datetime\Plugin\Field\FieldFormatterCode
protected function buildDate(DrupalDateTime $date) {
$this
->setTimeZone($date);
$build = [
'#markup' => $this
->formatDate($date),
'#cache' => [
'contexts' => [
'timezone',
],
],
];
return $build;
}