diff --git a/core/modules/field/modules/entityreference/entityreference.module b/core/modules/field/modules/entityreference/entityreference.module index 89e012e..4d17efa 100644 --- a/core/modules/field/modules/entityreference/entityreference.module +++ b/core/modules/field/modules/entityreference/entityreference.module @@ -354,6 +354,33 @@ function entityreference_autocomplete_access_callback($type, $field_name, $entit function entityreference_autocomplete_callback($type, $field_name, $entity_type, $bundle_name, $entity_id = '', $string = '') { $field = field_info_field($field_name); $instance = field_info_instance($entity_type, $field_name, $bundle_name); + + return entityreference_autocomplete_callback_get_matches($type, $field, $instance, $entity_type, $entity_id, $string); +} + +/** + * Return JSON based on given field, instance and string. + * + * This function can be used by other modules that wish to pass a mocked + * definition of the field on instance. + * + * @param $type + * The widget type (i.e. 'single' or 'tags'). + * @param $field + * The field array defintion. + * @param $instance + * The instance array defintion. + * @param $entity_type + * The entity type. + * @param $entity_id + * Optional; The entity ID the entity-reference field is attached to. + * Defaults to ''. + * @param $string + * The label of the entity to query by. + * + * @see entityreference_autocomplete_callback() + */ +function entityreference_autocomplete_callback_get_matches($type, $field, $instance, $entity_type, $entity_id = '', $string = '') { $matches = array(); $target_type = $field['settings']['target_type'];