1 entityreference.module | _entityreference_get_behavior_handler($behavior) |
Get the behavior handler for a given entityreference field and instance.
Parameters
$behavior: The behavior handler name.
File
- core/
modules/ entityreference/ entityreference.module, line 145 - Entityreference primary module file.
Code
function _entityreference_get_behavior_handler($behavior) {
$object_cache = backdrop_static(__FUNCTION__);
if (!isset($object_cache[$behavior])) {
$class = entityreference_load_behavior_class($behavior);
// Ensure the class is available, setting it as broken if it isn't.
if (!$class || !class_exists($class)) {
include_once (dirname(__FILE__) . '/plugins/behavior/EntityReferenceBehaviorHandler.inc');
$class = 'EntityReferenceBehaviorHandlerBroken';
}
$object_cache[$behavior] = new $class($behavior);
}
return $object_cache[$behavior];
}