From e490c55e402d2d578f42ff33b1073f0bb023addb Mon Sep 17 00:00:00 2001 From: xjm Date: Tue, 14 Sep 2021 17:08:09 -0500 Subject: [PATCH] SA-CORE-2021-010 by bradjones1, xjm, bbrala, gabesullice, Wim Leers, e0ipso --- modules/jsonapi/src/ResourceType/ResourceType.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/jsonapi/src/ResourceType/ResourceType.php b/modules/jsonapi/src/ResourceType/ResourceType.php index 07d92c7387d..9ece04124d1 100644 --- a/modules/jsonapi/src/ResourceType/ResourceType.php +++ b/modules/jsonapi/src/ResourceType/ResourceType.php @@ -400,7 +400,7 @@ public function getRelatableResourceTypes() { $this->relatableResourceTypesByField = array_reduce(array_map(function (ResourceTypeRelationship $field) { return [$field->getPublicName() => $field->getRelatableResourceTypes()]; }, array_filter($this->fields, function (ResourceTypeField $field) { - return $field instanceof ResourceTypeRelationship; + return $field instanceof ResourceTypeRelationship && $field->isFieldEnabled(); })), 'array_merge', []); } return $this->relatableResourceTypesByField; @@ -418,7 +418,7 @@ public function getRelatableResourceTypes() { * @see self::getRelatableResourceTypes() */ public function getRelatableResourceTypesByField($field_name) { - return ($field = $this->getFieldByPublicName($field_name)) && $field instanceof ResourceTypeRelationship + return ($field = $this->getFieldByPublicName($field_name)) && $field instanceof ResourceTypeRelationship && $field->isFieldEnabled() ? $field->getRelatableResourceTypes() : []; }