function ckeditor_link_autocomplete in CKEditor Link 6
Same name and namespace in other branches
- 6.2 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 38 - Written by Henri MEDOT <henri.medot[AT]absyx[DOT]fr> http://www.absyx.fr
Code
function ckeditor_link_autocomplete($string = '') {
$matches = array();
if ($string !== '') {
$sql = db_rewrite_sql("SELECT n.nid, n.title FROM {node} n WHERE n.title LIKE '%%%s%%' ORDER BY n.title, n.type");
$result = db_query_range($sql, array(
$string,
), 0, 10);
while ($node = db_fetch_object($result)) {
$matches[$node->title . ' (node/' . $node->nid . ')'] = '<div class="reference-autocomplete">' . check_plain($node->title) . '</div>';
}
}
drupal_json($matches);
}