1 entityreference.module entityreference_get_selection_handler($field, $instance = NULL, $entity_type = NULL, $entity = NULL)

Get the selection handler for a given entityreference field.

File

core/modules/entityreference/entityreference.module, line 166
Entityreference primary module file.

Code

function entityreference_get_selection_handler($field, $instance = NULL, $entity_type = NULL, $entity = NULL) {
  $handler = $field['settings']['handler'];
  $class = entityreference_load_selection_class($handler);

  if ($class && class_exists($class)) {
    return call_user_func(array($class, 'getInstance'), $field, $instance, $entity_type, $entity);
  }
  else {
    return EntityReferenceSelectionHandlerBroken::getInstance($field, $instance, $entity_type, $entity);
  }
}