You are here

function _user_relationships_autocomplete_types in User Relationships 5

Same name and namespace in other branches
  1. 5.2 user_relationships.module \_user_relationships_autocomplete_types()

Adds autocompletion capability

1 string reference to '_user_relationships_autocomplete_types'
user_relationships_menu in ./user_relationships_hooks.inc
Menu

File

./user_relationships.module, line 32

Code

function _user_relationships_autocomplete_types($string = '') {
  $matches = array();
  if ($string) {
    $result = db_query_range("SELECT name FROM {user_relationship_types} WHERE LOWER(name) LIKE LOWER('%%%s%%')", $string, 0, 10);
    while ($relationship = db_fetch_object($result)) {
      $matches[$relationship->name] = check_plain($relationship->name);
    }
  }
  print drupal_to_js($matches);
  exit;
}