function ResourceTypeRepository::isVersionableResourceType

Same name in other branches
  1. 9 core/modules/jsonapi/src/ResourceType/ResourceTypeRepository.php \Drupal\jsonapi\ResourceType\ResourceTypeRepository::isVersionableResourceType()
  2. 10 core/modules/jsonapi/src/ResourceType/ResourceTypeRepository.php \Drupal\jsonapi\ResourceType\ResourceTypeRepository::isVersionableResourceType()
  3. 11.x core/modules/jsonapi/src/ResourceType/ResourceTypeRepository.php \Drupal\jsonapi\ResourceType\ResourceTypeRepository::isVersionableResourceType()

Whether an entity type is a versionable resource type.

Parameters

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

Return value

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

2 calls to ResourceTypeRepository::isVersionableResourceType()
CountableResourceTypeRepository::createResourceType in core/modules/jsonapi/tests/modules/jsonapi_test_collection_count/src/ResourceType/CountableResourceTypeRepository.php
Creates a ResourceType value object for the given entity type + bundle.
ResourceTypeRepository::createResourceType in core/modules/jsonapi/src/ResourceType/ResourceTypeRepository.php
Creates a ResourceType value object for the given entity type + bundle.

File

core/modules/jsonapi/src/ResourceType/ResourceTypeRepository.php, line 405

Class

ResourceTypeRepository
Provides a repository of all JSON:API resource types.

Namespace

Drupal\jsonapi\ResourceType

Code

protected static function isVersionableResourceType(EntityTypeInterface $entity_type) {
    // @todo: remove the following line and uncomment the next one when revisions have standardized access control. For now, it is unsafe to support all revisionable entity types.
    return in_array($entity_type->id(), [
        'node',
        'media',
    ]);
    
    /* return $entity_type->isRevisionable(); */
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.