ckeditor_link.menu.inc

  1. cis7 sites/all/modules/ulmus/ckeditor_link/includes/ckeditor_link.menu.inc
  2. cle7 sites/all/modules/ulmus/ckeditor_link/includes/ckeditor_link.menu.inc
  3. ecd7 sites/all/modules/ulmus/ckeditor_link/includes/ckeditor_link.menu.inc
  4. elmsmedia7 sites/all/modules/ulmus/ckeditor_link/includes/ckeditor_link.menu.inc
  5. harmony7 sites/all/modules/ulmus/ckeditor_link/includes/ckeditor_link.menu.inc
  6. icor7 sites/all/modules/ulmus/ckeditor_link/includes/ckeditor_link.menu.inc
  7. meedjum_blog7 sites/all/modules/ulmus/ckeditor_link/includes/ckeditor_link.menu.inc
  8. mooc7 sites/all/modules/ulmus/ckeditor_link/includes/ckeditor_link.menu.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.menu.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_menu_autocomplete($string, $limit) {
  11. $matches = array();
  12. $menus = array_keys(array_filter(variable_get('ckeditor_link_autocomplete_menus', array())));
  13. if (count($menus)) {
  14. $query = db_select('menu_links')
  15. ->fields('menu_links', array('link_path', 'link_title'))
  16. ->condition('link_title', '%'. db_like($string) .'%', 'LIKE')
  17. ->condition('hidden', 0)
  18. ->condition('external', 0)
  19. ->orderBy('link_title')
  20. ->range(0, $limit);
  21. if (function_exists('ckeditor_link_ckeditor_link_i18n_menu_autocomplete')) {
  22. $query->fields('menu_links', array('language'));
  23. }
  24. if (!in_array('- any -', $menus)) {
  25. $query->condition('menu_name', $menus, 'IN');
  26. }
  27. $result = $query->execute();
  28. foreach ($result as $item) {
  29. if (_ckeditor_link_check_path($item->link_path)) {
  30. $router_item = menu_get_item($item->link_path);
  31. if ($router_item && $router_item['access']) {
  32. $langcode = (isset($item->language)) ? $item->language : LANGUAGE_NONE;
  33. $path = ckeditor_link_path_prefix_language($item->link_path, $langcode);
  34. $matches[$path] = $item->link_title;
  35. }
  36. }
  37. }
  38. }
  39. return $matches;
  40. }
  41. /**
  42. * Implementation of hook_ckeditor_link_TYPE_revert().
  43. */
  44. function ckeditor_link_ckeditor_link_menu_revert($path, &$langcode) {
  45. if (function_exists('ckeditor_link_ckeditor_link_i18n_menu_revert')) {
  46. return;
  47. }
  48. $router_item = menu_get_item($path);
  49. if ($router_item) {
  50. if (!$router_item['access']) {
  51. return FALSE;
  52. }
  53. $link_title = db_query("SELECT link_title FROM {menu_links} WHERE link_path = :link_path AND hidden = 0 ORDER BY customized DESC", array(':link_path' => $path))->fetchField();
  54. return ($link_title) ? $link_title : NULL;
  55. }
  56. }
  57. /**
  58. * Implementation of hook_ckeditor_link_TYPE_settings().
  59. */
  60. function ckeditor_link_ckeditor_link_menu_settings() {
  61. $form = array();
  62. if (module_exists('menu')) {
  63. $form['menu'] = array(
  64. '#type' => 'fieldset',
  65. '#title' => t('Menu items'),
  66. );
  67. $form['menu']['ckeditor_link_autocomplete_menus'] = array(
  68. '#type' => 'checkboxes',
  69. '#title' => t('Menus'),
  70. '#options' => array('- any -' => t('<em>Any menu</em>')) + array_map('check_plain', menu_get_menus()),
  71. '#default_value' => variable_get('ckeditor_link_autocomplete_menus', array()),
  72. '#description' => t('Select the menus to be available as autocomplete suggestions.'),
  73. );
  74. }
  75. return $form;
  76. }
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.