You are here

public function ResourceType::getRelatableResourceTypesByField in JSON:API 8.2

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

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