function ccl_node_autocomplete in Custom Contextual Links 8
Same name and namespace in other branches
- 7 ccl.admin.inc \ccl_node_autocomplete()
Node ID autocomplete callback function.
1 string reference to 'ccl_node_autocomplete'
- ccl_menu in ./
ccl.module - Implements hook_menu().
File
- ./
ccl.admin.inc, line 390 - Provides administrative functions for ccl.
Code
function ccl_node_autocomplete($string = '') {
$matches = array();
if ($string) {
$result = db_select('node', 'n')
->fields('n', array(
'title',
'nid',
))
->condition('title', db_like($string) . '%', 'LIKE')
->range(0, 10)
->execute();
foreach ($result as $node) {
$matches[\Drupal\Component\Utility\Html::escape($node->title) . ' [nid:' . $node->nid . ']'] = \Drupal\Component\Utility\Html::escape($node->title);
}
}
drupal_json_output($matches);
}