function og_vocab_autocomplete_callback in OG Vocabulary 7
Menu callback: autocomplete the label of an entity.
@todo: Get the field in instance settings, based on the group and vocabulary ID.
Parameters
$type: The widget type (i.e. 'single' or 'tags').
$field_name: The name of the entity-reference field.
$entity_type: The entity type.
$bundle_name: The bundle name.
$vid: The vocabulary ID.
$entity_id: Optional; The entity ID the entity-reference field is attached to. Defaults to ''.
$string: The label of the entity to query by.
1 string reference to 'og_vocab_autocomplete_callback'
- og_vocab_menu in ./
og_vocab.module - Implements hook_menu().
File
- ./
og_vocab.module, line 563 - Give each group its own system controlled vocabularies.
Code
function og_vocab_autocomplete_callback($type, OgVocab $og_vocab, $entity_id = '', $string = '') {
$mocked_field = $og_vocab
->getMockedField();
$instance = $mocked_field['instance'];
$field = $mocked_field['field'];
$entity_type = $og_vocab->entity_type;
if (!$field || !$instance || $field['type'] != 'entityreference' || !field_access('edit', $field, $entity_type)) {
return MENU_ACCESS_DENIED;
}
return entityreference_autocomplete_callback_get_matches($type, $field, $instance, $entity_type, $entity_id, $string);
}