You are here

function entityreference_get_selection_handler in Entity reference 7

Same name and namespace in other branches
  1. 8 entityreference.module \entityreference_get_selection_handler()

Get the selection handler for a given entityreference field.

10 calls to entityreference_get_selection_handler()
EntityReferenceHandlersTestCase::assertReferencable in tests/entityreference.handlers.test
EntityReferenceHandlersTestCase::testNodeHandler in tests/entityreference.handlers.test
Test the node-specific overrides of the entity handler.
EntityReferenceHandlersTestCase::testSortByField in tests/entityreference.handlers.test
Assert sorting by field works for non-admins.
entityreference_autocomplete_callback_get_matches in ./entityreference.module
Return JSON based on given field, instance and string.
entityreference_feeds_set_target in ./entityreference.feeds.inc
Entity reference callback for mapping.

... See full list

File

./entityreference.module, line 207
Entityreference primary module file.

Code

function entityreference_get_selection_handler($field, $instance = NULL, $entity_type = NULL, $entity = NULL) {
  ctools_include('plugins');
  $handler = $field['settings']['handler'];
  $class = ctools_plugin_load_class('entityreference', 'selection', $handler, 'class');
  if (class_exists($class)) {
    return call_user_func(array(
      $class,
      'getInstance',
    ), $field, $instance, $entity_type, $entity);
  }
  else {
    return EntityReference_SelectionHandler_Broken::getInstance($field, $instance, $entity_type, $entity);
  }
}