You are here

protected static function ResourceTypeRepository::shouldBeInternalResourceType in JSON:API 8

Whether an entity type should be an internal resource type.

@todo: remove when minimum supported core version is >= 8.5, update the caller to instead call EntityTypeInterface::isInternal().

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type to assess.

Return value

bool TRUE if the entity type is internal, FALSE otherwise.

1 call to ResourceTypeRepository::shouldBeInternalResourceType()
ResourceTypeRepository::all in src/ResourceType/ResourceTypeRepository.php
Gets all JSON API resource types.

File

src/ResourceType/ResourceTypeRepository.php, line 158

Class

ResourceTypeRepository
Provides a repository of all JSON API resource types.

Namespace

Drupal\jsonapi\ResourceType

Code

protected static function shouldBeInternalResourceType(EntityTypeInterface $entity_type) {
  if (method_exists(EntityTypeInterface::class, 'isInternal')) {
    return $entity_type
      ->isInternal();
  }
  return $entity_type
    ->id() === 'content_moderation_state';
}