function entity_access_controller

Returns the entity access controller for the given entity type.

Parameters

string $entity_type: The type of the entity.

Return value

\Drupal\Core\Entity\EntityAccessControllerInterface An entity access controller instance.

See also

\Drupal\Core\Entity\EntityManager

1 call to entity_access_controller()
EntityAccessTest::testEntityAccessDefaultController in drupal/core/modules/system/lib/Drupal/system/Tests/Entity/EntityAccessTest.php
Ensures that the default controller is used as a fallback.

File

drupal/core/includes/entity.inc, line 318
Entity API for handling entities like nodes or users.

Code

function entity_access_controller($entity_type) {
  $controllers =& drupal_static(__FUNCTION__, array());
  if (!isset($controllers[$entity_type])) {
    $type_info = entity_get_info($entity_type);
    $class = $type_info['access_controller_class'];
    $controllers[$entity_type] = new $class($entity_type);
  }
  return $controllers[$entity_type];
}