/**
* Get all resource types with which this type may have a relationship.
*
* @return array
* The relatable resource types, keyed by relationship field names.
*
* @see self::setRelatableResourceTypes()
*/
public function getRelatableResourceTypes() { if (!
isset($this->relatableResourceTypesByField
)) { $this->relatableResourceTypesByField =
array_reduce(array_map(function DResourceTypeRelationship
$field) { return [$field->
getPublicName() =>
$field->
getRelatableResourceTypes()];
},
array_filter($this->fields,
function DResourceTypeField
$field) { return $field instanceof ResourceTypeRelationship &&
$field->
isFieldEnabled();
})), 'array_merge',
[]);
} return $this->relatableResourceTypesByField;
} /**
* Get all resource types with which the given field may have a relationship.
*
* @param string $field_name
* The public field name.
*
* @return \Drupal\jsonapi\ResourceType\ResourceType[]
* The relatable JSON:API resource types.
*
* @see self::getRelatableResourceTypes()
*/