You are here

public function ResourceType::getRelatableResourceTypesByField in JSON:API 8

Same name and namespace in other branches
  1. 8.2 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

src/ResourceType/ResourceType.php, line 261

Class

ResourceType
Value object containing all metadata for a JSON API resource type.

Namespace

Drupal\jsonapi\ResourceType

Code

public function getRelatableResourceTypesByField($field_name) {
  $relatable_resource_types = $this
    ->getRelatableResourceTypes();
  return isset($relatable_resource_types[$field_name]) ? $relatable_resource_types[$field_name] : [];
}