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 143
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);

    $class = class_exists($class) ? $class : 'EntityReferenceBehaviorHandlerBroken';
    $object_cache[$behavior] = new $class($behavior);
  }

  return $object_cache[$behavior];
}