You are here

function nice_mega_dropdowns_autocomplete in Nice Menus 7.3

Same name and namespace in other branches
  1. 7.2 nice_mega_dropdowns/nice_mega_dropdowns.module \nice_mega_dropdowns_autocomplete()
1 string reference to 'nice_mega_dropdowns_autocomplete'
nice_mega_dropdowns_menu in nice_mega_dropdowns/nice_mega_dropdowns.module
Implements hook_menu().

File

nice_mega_dropdowns/nice_mega_dropdowns.module, line 96
Module which allows nodes to be used as dropdown menus.

Code

function nice_mega_dropdowns_autocomplete($string) {
  $items = array();
  $string = $string . '%%';
  $result = db_query("SELECT nid, title FROM {node} WHERE status = 1 AND title LIKE :string", array(
    ':string' => $string,
  ));
  foreach ($result as $record) {
    $items[$record->title] = $record->title;
  }
  drupal_json_output($items);
}