mysite_type_hook_autocomplete

Definition

mysite_type_hook_autocomplete($string)
API.php, line 465

Description

AJAX autocomplete for aggregator titles.

Since plugins don't have their own menu items, we pass all autocomplete requests through mysite_autocomplete, which then invokes this internal hook.

See http://drupal.org/node/42552 for additional information about AJAX autocomplete.

Invoked by mysite_autocomplete().

Parameters

$string The search string entered by the user.

Return value

An array of items that matched the search routine.

Related topics

Namesort iconDescription
MySite HooksInternal module hooks used by MySite includes.

Code

function mysite_type_hook_autocomplete($string) {
  $matches = array();
  $result = db_query_range("SELECT id, title FROM {mytable} WHERE title LIKE LOWER('%s%%')", $string, 0, 10);
  while ($data = db_fetch_object($result)) {
    $matches[$data->title] = check_plain($data->title);
  }
  return $matches;
}