function ResourceType::getRelatableResourceTypesByField
Same name in other branches
- 9 core/modules/jsonapi/src/ResourceType/ResourceType.php \Drupal\jsonapi\ResourceType\ResourceType::getRelatableResourceTypesByField()
- 10 core/modules/jsonapi/src/ResourceType/ResourceType.php \Drupal\jsonapi\ResourceType\ResourceType::getRelatableResourceTypesByField()
- 11.x core/modules/jsonapi/src/ResourceType/ResourceType.php \Drupal\jsonapi\ResourceType\ResourceType::getRelatableResourceTypesByField()
Get all resource types with which the given field may have a relationship.
Parameters
string $field_name: The public field name.
Return value
\Drupal\jsonapi\ResourceType\ResourceType[] The relatable JSON:API resource types.
See also
self::getRelatableResourceTypes()
File
-
core/
modules/ jsonapi/ src/ ResourceType/ ResourceType.php, line 420
Class
- ResourceType
- Value object containing all metadata for a JSON:API resource type.
Namespace
Drupal\jsonapi\ResourceTypeCode
public function getRelatableResourceTypesByField($field_name) {
return ($field = $this->getFieldByPublicName($field_name)) && $field instanceof ResourceTypeRelationship && $field->isFieldEnabled() ? $field->getRelatableResourceTypes() : [];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.