You are here

function _quotes_autocomplete_citation in Quotes 6

Same name and namespace in other branches
  1. 5 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 1742
The quotes module allows users to maintain a list of quotes that can be displayed in any number of administrator-defined quote blocks.

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);
  }
  drupal_json($matches);
}