You are here

function i18n_taxonomy_autocomplete_field in Internationalization 7

Helper function for autocompletion. Replacement for taxonomy_autocomplete

1 string reference to 'i18n_taxonomy_autocomplete_field'
i18n_taxonomy_menu_alter in i18n_taxonomy/i18n_taxonomy.module
Implements hook_menu_alter().

File

i18n_taxonomy/i18n_taxonomy.pages.inc, line 68
Page callbacks for the taxonomy module, i18n remake.

Code

function i18n_taxonomy_autocomplete_field($field_name, $tags_typed = '') {

  // Part of the criteria for the query come from the field's own settings.
  $field = field_info_field($field_name);
  $vids = array();
  $vocabularies = taxonomy_vocabulary_get_names();
  foreach ($field['settings']['allowed_values'] as $tree) {
    $vids[] = $vocabularies[$tree['vocabulary']]->vid;
  }

  // This has been redirected from taxonomy module so we add current language and no language
  // Because some of the vocabularies may not have language
  $langcode = array(
    i18n_langcode(),
    LANGUAGE_NONE,
  );
  return _i18n_taxonomy_autocomplete($langcode, $vids, $tags_typed);
}