1 entity.module entity_get_controller($entity_type)

Gets the entity controller class for an entity type.

Return value

EntityStorageControllerInterface

File

core/modules/entity/entity.module, line 455
Entity API for handling entities like nodes or users.

Code

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