You are here

public function EntityAccessControlHandler::__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/EntityAccessControlHandler.php, line 21

Class

EntityAccessControlHandler
Controls access based on the generic 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'), EntityPermissionProvider::class, TRUE)) {
    throw new \Exception('\\Drupal\\entity\\EntityAccessControlHandler requires the \\Drupal\\entity\\EntityPermissionProvider permission provider.');
  }
}