function ckeditor_link_ckeditor_link_i18n_taxonomy_autocomplete

cis7 ckeditor_link.i18n_taxonomy.inc ckeditor_link_ckeditor_link_i18n_taxonomy_autocomplete($string, $limit)
cle7 ckeditor_link.i18n_taxonomy.inc ckeditor_link_ckeditor_link_i18n_taxonomy_autocomplete($string, $limit)
elmsmedia7 ckeditor_link.i18n_taxonomy.inc ckeditor_link_ckeditor_link_i18n_taxonomy_autocomplete($string, $limit)
icor7 ckeditor_link.i18n_taxonomy.inc ckeditor_link_ckeditor_link_i18n_taxonomy_autocomplete($string, $limit)
meedjum_blog7 ckeditor_link.i18n_taxonomy.inc ckeditor_link_ckeditor_link_i18n_taxonomy_autocomplete($string, $limit)
mooc7 ckeditor_link.i18n_taxonomy.inc ckeditor_link_ckeditor_link_i18n_taxonomy_autocomplete($string, $limit)

Implementation of hook_ckeditor_link_TYPE_autocomplete().

File

sites/all/modules/ulmus/ckeditor_link/includes/ckeditor_link.i18n_taxonomy.inc, line 11
Written by Henri MEDOT <henri.medot[AT]absyx[DOT]fr> http://www.absyx.fr

Code

function ckeditor_link_ckeditor_link_i18n_taxonomy_autocomplete($string, $limit) {
  // Currently, this function only supports MySQL.
  // TODO: Add support for pgsql.
  if (!in_array(db_driver(), array('mysql'))) {
    return array();
  }

  $matches = array();

  $vocabularies = array_keys(array_filter(variable_get('ckeditor_link_autocomplete_vocabularies', array())));
  if (count($vocabularies)) {
    $query = db_select('taxonomy_term_data', 't');
    $query->innerJoin('locales_source', 'ls', 'ls.context = CONCAT(:prefix, t.tid, :suffix)', array(':prefix' => 'term:', ':suffix' => ':name'));
    $query->innerJoin('locales_target', 'lt', 'lt.lid = ls.lid');
    $query->fields('t', array('tid'));
    $query->addExpression('CONVERT(lt.translation USING utf8)', 'name');
    $query->fields('lt', array('language'));
    $query->where('CONVERT(lt.translation USING utf8) LIKE :pattern', array(':pattern' => '%' . db_like($string) . '%'));
    $query->orderBy('name');
    $query->range(0, $limit);
    $query->addTag('term_access');
    if (!in_array('- any -', $vocabularies)) {
      $query->condition('t.vid', $vocabularies, 'IN');
    }
    $result = $query->execute();
    foreach ($result as $term) {
      $path = ckeditor_link_path_prefix_language('taxonomy/term/' . $term->tid, $term->language);
      $matches[$path] = $term->name;
    }
  }

  return $matches;
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.