You are here

public function ResourceType::isInternal in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/jsonapi/src/ResourceType/ResourceType.php \Drupal\jsonapi\ResourceType\ResourceType::isInternal()
  2. 10 core/modules/jsonapi/src/ResourceType/ResourceType.php \Drupal\jsonapi\ResourceType\ResourceType::isInternal()

Whether this resource type is internal.

This must not be used as an access control mechanism.

Internal resource types are not available via the HTTP API. They have no routes and cannot be used for filtering or sorting. They cannot be included in the response using the `include` query parameter.

However, relationship fields on public resources *will include* a resource identifier for the referenced internal resource.

This method exists to remove data that should not logically be exposed by the HTTP API. For example, read-only data from an internal resource might be embedded in a public resource using computed fields. Therefore, including the internal resource as a relationship with distinct routes might unnecessarily expose internal implementation details.

Return value

bool TRUE if the resource type is internal. FALSE otherwise.

File

core/modules/jsonapi/src/ResourceType/ResourceType.php, line 290

Class

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

Namespace

Drupal\jsonapi\ResourceType

Code

public function isInternal() {
  return $this->internal;
}