You are here

protected function TimestampItemNormalizer::normalizedFieldValues in Drupal 8

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

Normalizes field values for an item.

Parameters

\Drupal\Core\Field\FieldItemInterface $field_item: The field item instance.

string|null $format: The normalization format.

array $context: The context passed into the normalizer.

Return value

array An array of field item values, keyed by property name.

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,
  ];
}