function NormalizerBase::addCacheableDependency
Same name in other branches
- 9 core/modules/serialization/src/Normalizer/NormalizerBase.php \Drupal\serialization\Normalizer\NormalizerBase::addCacheableDependency()
- 8.9.x core/modules/serialization/src/Normalizer/NormalizerBase.php \Drupal\serialization\Normalizer\NormalizerBase::addCacheableDependency()
- 11.x core/modules/serialization/src/Normalizer/NormalizerBase.php \Drupal\serialization\Normalizer\NormalizerBase::addCacheableDependency()
Adds cacheability if applicable.
Parameters
array $context: Context options for the normalizer.
$data: The data that might have cacheability information.
3 calls to NormalizerBase::addCacheableDependency()
- EntityReferenceFieldItemNormalizer::normalize in core/
modules/ serialization/ src/ Normalizer/ EntityReferenceFieldItemNormalizer.php - PrimitiveDataNormalizer::normalize in core/
modules/ serialization/ src/ Normalizer/ PrimitiveDataNormalizer.php - TypedDataNormalizer::normalize in core/
modules/ serialization/ src/ Normalizer/ TypedDataNormalizer.php
File
-
core/
modules/ serialization/ src/ Normalizer/ NormalizerBase.php, line 100
Class
- NormalizerBase
- Base class for Normalizers.
Namespace
Drupal\serialization\NormalizerCode
protected function addCacheableDependency(array $context, $data) {
if ($data instanceof CacheableDependencyInterface && isset($context[static::SERIALIZATION_CONTEXT_CACHEABILITY])) {
$context[static::SERIALIZATION_CONTEXT_CACHEABILITY]->addCacheableDependency($data);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.