You are here

function _quotes_autocomplete_citation in Quotes 5

Same name and namespace in other branches
  1. 6 quotes.module \_quotes_autocomplete_citation()
  2. 7 quotes.module \_quotes_autocomplete_citation()

Function to provide autocomplete for citation field.

Parameters

$string - the string currently entered by the user.:

Return value

array of matches in JSON format.

1 string reference to '_quotes_autocomplete_citation'
quotes_menu in ./quotes.module
Implementation of hook_menu().

File

./quotes.module, line 249

Code

function _quotes_autocomplete_citation($string) {
  $matches = array();
  $result = db_query("SELECT citation FROM {quotes} WHERE LOWER(citation) LIKE LOWER('%%%s%%')", $string);
  while ($row = db_fetch_object($result)) {
    $matches[$row->citation] = check_plain($row->citation);
  }
  print drupal_to_js($matches);
}