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() : []; }