function TimestampItemNormalizer::normalizedFieldValues

Same name in other branches
  1. 8.9.x core/modules/hal/src/Normalizer/TimestampItemNormalizer.php \Drupal\hal\Normalizer\TimestampItemNormalizer::normalizedFieldValues()

Overrides FieldItemNormalizer::normalizedFieldValues

File

core/modules/hal/src/Normalizer/TimestampItemNormalizer.php, line 27

Class

TimestampItemNormalizer
Converts values for TimestampItem to and from common formats for hal.

Namespace

Drupal\hal\Normalizer

Code

protected function normalizedFieldValues(FieldItemInterface $field_item, $format, array $context) {
    return parent::normalizedFieldValues($field_item, $format, $context) + [
        // 'format' is not a property on Timestamp objects. This is present to
        // assist consumers of this data.
'format' => \DateTime::RFC3339,
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.