Created
November 9, 2012 21:32
-
-
Save jessebeach/4048393 to your computer and use it in GitHub Desktop.
entity_get_controller#entity.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Gets the entity controller class for an entity type. | |
* | |
* @return Drupal\Core\Entity\EntityStorageControllerInterface | |
*/ | |
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]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment