You are here

function _user_relationships_ui_autocomplete_types in User Relationships 6

Same name and namespace in other branches
  1. 5.3 user_relationships_ui/user_relationships_ui.module \_user_relationships_ui_autocomplete_types()

Adds autocompletion capability

1 string reference to '_user_relationships_ui_autocomplete_types'
user_relationships_ui_menu in user_relationships_ui/user_relationships_ui.module
Implementation of hook_menu().

File

user_relationships_ui/user_relationships_ui.module, line 181
UI components of user_relationships @author Jeff Smick (creator) @author Alex Karshakevich (maintainer) http://drupal.org/user/183217 @author Darren Ferguson (contributor) http://drupal.org/user/70179

Code

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