function TimestampItemNormalizer::constructValue
Same name in this branch
- 9 core/modules/hal/src/Normalizer/TimestampItemNormalizer.php \Drupal\hal\Normalizer\TimestampItemNormalizer::constructValue()
Same name in other branches
- 8.9.x core/modules/serialization/src/Normalizer/TimestampItemNormalizer.php \Drupal\serialization\Normalizer\TimestampItemNormalizer::constructValue()
- 8.9.x core/modules/hal/src/Normalizer/TimestampItemNormalizer.php \Drupal\hal\Normalizer\TimestampItemNormalizer::constructValue()
- 10 core/modules/serialization/src/Normalizer/TimestampItemNormalizer.php \Drupal\serialization\Normalizer\TimestampItemNormalizer::constructValue()
- 11.x core/modules/serialization/src/Normalizer/TimestampItemNormalizer.php \Drupal\serialization\Normalizer\TimestampItemNormalizer::constructValue()
Overrides FieldableEntityNormalizerTrait::constructValue
File
-
core/
modules/ serialization/ src/ Normalizer/ TimestampItemNormalizer.php, line 38
Class
- TimestampItemNormalizer
- Converts values for TimestampItem to and from common formats.
Namespace
Drupal\serialization\NormalizerCode
protected function constructValue($data, $context) {
if (!empty($data['format'])) {
$context['datetime_allowed_formats'] = [
$data['format'],
];
}
return [
'value' => $this->serializer
->denormalize($data['value'], Timestamp::class, NULL, $context),
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.