You are here

public static function AccessUnpublished::applicableEntityType in Access unpublished 8

Check if the entity type can be used with access unpublished.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entityType: The entity type.

Return value

bool TRUE if it can be used.

6 calls to AccessUnpublished::applicableEntityType()
AccessTokenManager::getAccessTokensByEntity in src/AccessTokenManager.php
Obtains access tokens for a given entity.
AccessUnpublishedForm::formAlter in src/Form/AccessUnpublishedForm.php
Alter the entity form to add access unpublished elements.
AccessUnpublishedPermissions::permissions in src/AccessUnpublishedPermissions.php
Permissions callback.
access_unpublished_entity_access in ./access_unpublished.module
Implements hook_entity_access().
access_unpublished_tokens in ./access_unpublished.tokens.inc
Implements hook_tokens().

... See full list

File

src/AccessUnpublished.php, line 22

Class

AccessUnpublished
Utility class.

Namespace

Drupal\access_unpublished

Code

public static function applicableEntityType(EntityTypeInterface $entityType) {
  if (in_array(EntityPublishedInterface::class, class_implements($entityType
    ->getClass())) && $entityType
    ->hasLinkTemplate('canonical')) {
    return TRUE;
  }
  return FALSE;
}