function TimestampItemNormalizer::normalize

Same name in other branches
  1. 8.9.x core/modules/serialization/src/Normalizer/TimestampItemNormalizer.php \Drupal\serialization\Normalizer\TimestampItemNormalizer::normalize()
  2. 10 core/modules/serialization/src/Normalizer/TimestampItemNormalizer.php \Drupal\serialization\Normalizer\TimestampItemNormalizer::normalize()
  3. 11.x core/modules/serialization/src/Normalizer/TimestampItemNormalizer.php \Drupal\serialization\Normalizer\TimestampItemNormalizer::normalize()

Overrides ComplexDataNormalizer::normalize

File

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

Class

TimestampItemNormalizer
Converts values for TimestampItem to and from common formats.

Namespace

Drupal\serialization\Normalizer

Code

public function normalize($object, $format = NULL, array $context = []) {
    return parent::normalize($object, $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.