function entity_get_controller

entity_get_controller($entity_type)

Gets the entity controller for an entity type.

Return value

DrupalEntityControllerInterface The entity controller object for the specified entity type.

File

includes/common.inc, line 8021
Common functions that many Drupal modules will need to reference.

Code

function entity_get_controller($entity_type) {
  $controllers = &drupal_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];
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!common.inc/function/entity_get_controller/7.x