function ckeditor_link_autocomplete in CKEditor Link 6.2
Same name and namespace in other branches
- 6 ckeditor_link.module \ckeditor_link_autocomplete()
- 7.2 ckeditor_link.module \ckeditor_link_autocomplete()
- 7 ckeditor_link.module \ckeditor_link_autocomplete()
1 string reference to 'ckeditor_link_autocomplete'
- ckeditor_link_menu in ./
ckeditor_link.module - Implementation of hook_menu().
File
- ./
ckeditor_link.module, line 41 - Written by Henri MEDOT <henri.medot[AT]absyx[DOT]fr> http://www.absyx.fr
Code
function ckeditor_link_autocomplete($string = '') {
$matches = array();
if ($string !== '') {
$types = ckeditor_link_get_types();
$limit = variable_get('ckeditor_link_limit', 10);
$results = array();
foreach ($types as $type) {
$func = $type['module'] . '_ckeditor_link_' . $type['type'] . '_autocomplete';
if (function_exists($func)) {
$results += $func($string, $limit);
if (count($results) > $limit) {
break;
}
}
}
drupal_alter('ckeditor_link_autocomplete', $results, $string);
array_splice($results, $limit);
foreach ($results as $path => $title) {
$matches[$title . ' (' . $path . ')'] = '<div class="reference-autocomplete">' . check_plain($title) . '</div>';
}
}
drupal_json($matches);
}