You are here

function _quotes_autocomplete_author in Quotes 6

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

Function to provide autocomplete for author field.

Parameters

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

Return value

array of matches in JSON format.

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

File

./quotes.module, line 1727
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_author($string) {
  $matches = array();
  $result = db_query("SELECT name FROM {quotes_authors} WHERE LOWER(name) LIKE LOWER('%%%s%%')", $string);
  while ($row = db_fetch_object($result)) {
    $matches[$row->name] = check_plain($row->name);
  }
  drupal_json($matches);
}