You are here

function terms_of_use_autocomplete in Terms of Use 6

Same name and namespace in other branches
  1. 7 terms_of_use.admin.inc \terms_of_use_autocomplete()

Helper function for autocompletion

1 string reference to 'terms_of_use_autocomplete'
terms_of_use_menu in ./terms_of_use.module
Implementation of hook_menu().

File

./terms_of_use.pages.inc, line 11
Page callbacks for the Terms of Use module.

Code

function terms_of_use_autocomplete($string = '') {
  $matches = array();
  if ($string != '') {
    $result = db_query_range(db_rewrite_sql("SELECT n.title FROM {node} AS n WHERE n.title LIKE '%%%s%%'"), $string, 0, 10);
    while ($node = db_fetch_object($result)) {
      $matches[$node->title] = $node->title;
    }
  }
  drupal_json($matches);
}