summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorharrrrrrr2017-11-09 22:29:36 +0100
committerMateu Aguiló Bosch2017-11-09 22:29:36 +0100
commit05f20db96e2317a05faeaab73192f39106a3672c (patch)
treeb535724b1ca946879505e6ddad24da59572c8b71
parent6f5d000a156b1fec1f99ab3b8dbeb6a9f1e35cee (diff)
fix(Cacheability): Prevent disabling Dynamic Page Caching (#2919197 by harrrrrrr)
-rw-r--r--src/Normalizer/EntityNormalizerTrait.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Normalizer/EntityNormalizerTrait.php b/src/Normalizer/EntityNormalizerTrait.php
index ee2eab0..d216c57 100644
--- a/src/Normalizer/EntityNormalizerTrait.php
+++ b/src/Normalizer/EntityNormalizerTrait.php
@@ -66,9 +66,11 @@ trait EntityNormalizerTrait {
$entity_type_id = $resource_type->getEntityTypeId();
$bundle_id = $resource_type->getBundle();
// The output depends on the configuration entity for caching.
- $context['cacheable_metadata']->addCacheableDependency(
- $this->getResourceConfig($entity_type_id, $bundle_id)
- );
+ if ($resource_config = $this->getResourceConfig($entity_type_id, $bundle_id)) {
+ $context['cacheable_metadata']->addCacheableDependency(
+ $resource_config
+ );
+ }
$context['cacheable_metadata']->addCacheableDependency(
\Drupal::config('jsonapi_extras.settings')
);