protected function NormalizerBase::addCacheableDependency in Drupal 10
Same name and namespace in other branches
- 8 core/modules/serialization/src/Normalizer/NormalizerBase.php \Drupal\serialization\Normalizer\NormalizerBase::addCacheableDependency()
- 9 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.
File
- core/
modules/ serialization/ src/ Normalizer/ NormalizerBase.php, line 96
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);
}
}