You are here

public function UncacheableEntityAccessControlHandler::__construct in Entity API 8

Constructs an access control handler instance.

Parameters

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

Overrides EntityAccessControlHandler::__construct

File

src/UncacheableEntityAccessControlHandler.php, line 23

Class

UncacheableEntityAccessControlHandler
Controls access based on the uncacheable entity permissions.

Namespace

Drupal\entity

Code

public function __construct(EntityTypeInterface $entity_type) {
  parent::__construct($entity_type);
  if (!$entity_type
    ->hasHandlerClass('permission_provider') || !is_a($entity_type
    ->getHandlerClass('permission_provider'), UncacheableEntityPermissionProvider::class, TRUE)) {
    throw new \Exception('\\Drupal\\entity\\UncacheableEntityAccessControlHandler requires the \\Drupal\\entity\\UncacheableEntityPermissionProvider permission provider.');
  }
}