ckeditor_link.taxonomy.inc

  1. cis7 sites/all/modules/ulmus/ckeditor_link/includes/ckeditor_link.taxonomy.inc
  2. cle7 sites/all/modules/ulmus/ckeditor_link/includes/ckeditor_link.taxonomy.inc
  3. ecd7 sites/all/modules/ulmus/ckeditor_link/includes/ckeditor_link.taxonomy.inc
  4. elmsmedia7 sites/all/modules/ulmus/ckeditor_link/includes/ckeditor_link.taxonomy.inc
  5. harmony7 sites/all/modules/ulmus/ckeditor_link/includes/ckeditor_link.taxonomy.inc
  6. icor7 sites/all/modules/ulmus/ckeditor_link/includes/ckeditor_link.taxonomy.inc
  7. meedjum_blog7 sites/all/modules/ulmus/ckeditor_link/includes/ckeditor_link.taxonomy.inc
  8. mooc7 sites/all/modules/ulmus/ckeditor_link/includes/ckeditor_link.taxonomy.inc

Written by Henri MEDOT <henri.medot[AT]absyx[DOT]fr> http://www.absyx.fr

Functions

File

sites/all/modules/ulmus/ckeditor_link/includes/ckeditor_link.taxonomy.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Written by Henri MEDOT <henri.medot[AT]absyx[DOT]fr>
  5. * http://www.absyx.fr
  6. */
  7. /**
  8. * Implementation of hook_ckeditor_link_TYPE_autocomplete().
  9. */
  10. function ckeditor_link_ckeditor_link_taxonomy_autocomplete($string, $limit) {
  11. $matches = array();
  12. $vocabularies = array_keys(array_filter(variable_get('ckeditor_link_autocomplete_vocabularies', array())));
  13. if (count($vocabularies)) {
  14. $query = db_select('taxonomy_term_data', 't')
  15. ->fields('t', array('tid', 'name'))
  16. ->condition('t.name', '%'. db_like($string) .'%', 'LIKE')
  17. ->orderBy('t.name')
  18. ->range(0, $limit)
  19. ->addTag('term_access');
  20. if (!in_array('- any -', $vocabularies)) {
  21. $query->condition('t.vid', $vocabularies, 'IN');
  22. }
  23. $result = $query->execute();
  24. foreach ($result as $term) {
  25. $matches['taxonomy/term/'. $term->tid] = $term->name;
  26. }
  27. }
  28. return $matches;
  29. }
  30. /**
  31. * Implementation of hook_ckeditor_link_TYPE_revert().
  32. */
  33. function ckeditor_link_ckeditor_link_taxonomy_revert($path, &$langcode) {
  34. if (function_exists('ckeditor_link_ckeditor_link_i18n_taxonomy_revert')
  35. || !preg_match('`^taxonomy/term/(\d+)$`', $path, $matches)) {
  36. return;
  37. }
  38. $tid = $matches[1];
  39. $name = db_select('taxonomy_term_data', 't')
  40. ->fields('t', array('name'))
  41. ->condition('t.tid', $tid)
  42. ->addTag('term_access')
  43. ->execute()
  44. ->fetchField();
  45. return ($name) ? $name : FALSE;
  46. }
  47. /**
  48. * Implementation of hook_ckeditor_link_TYPE_url().
  49. */
  50. function ckeditor_link_ckeditor_link_taxonomy_url($path, $langcode) {
  51. if (!preg_match('`^taxonomy/term/(\d+)$`', $path, $matches)) {
  52. return;
  53. }
  54. $tid = $matches[1];
  55. $languages = ckeditor_link_get_languages();
  56. if ($languages) {
  57. $term = taxonomy_term_load($tid);
  58. if ($term && ($language = @$term->language) && ($language != LANGUAGE_NONE) && isset($languages[$language])) {
  59. $langcode = $language;
  60. }
  61. }
  62. return ckeditor_link_url("taxonomy/term/$tid", $langcode);
  63. }
  64. /**
  65. * Implementation of hook_ckeditor_link_TYPE_settings().
  66. */
  67. function ckeditor_link_ckeditor_link_taxonomy_settings() {
  68. $form['taxonomy'] = array(
  69. '#type' => 'fieldset',
  70. '#title' => t('Taxonomy terms'),
  71. );
  72. $vocabularies = taxonomy_get_vocabularies();
  73. $options = array('- any -' => t('<em>Any vocabulary</em>'));
  74. foreach ($vocabularies as $vid => $vocabulary) {
  75. $options[$vid] = check_plain($vocabulary->name);
  76. }
  77. $form['taxonomy']['ckeditor_link_autocomplete_vocabularies'] = array(
  78. '#type' => 'checkboxes',
  79. '#title' => t('Vocabularies'),
  80. '#options' => $options,
  81. '#default_value' => variable_get('ckeditor_link_autocomplete_vocabularies', array()),
  82. '#description' => t('Select the vocabularies to be available as autocomplete suggestions.'),
  83. );
  84. return $form;
  85. }
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.