function imagepicker_group_search_autocomplete in Image Picker 7
Same name and namespace in other branches
- 5.2 imagepicker.module \imagepicker_group_search_autocomplete()
- 6.2 imagepicker.admin.inc \imagepicker_group_search_autocomplete()
Retrieve a pipe delimited string of autocomplete suggestions for existing groups
1 string reference to 'imagepicker_group_search_autocomplete'
- imagepicker_menu in ./
imagepicker.module - Implement hook_menu().
File
- ./
imagepicker.admin.inc, line 1774 - @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL
Code
function imagepicker_group_search_autocomplete($string = '') {
$matches = array();
if ($string) {
$query = db_select('imagepicker_user_groups', 'iug');
$query
->fields('iug', array(
'group_name',
));
$query
->where("LOWER(group_name) LIKE LOWER(:st)", array(
':st' => $string . '%',
));
$query
->range(0, 10);
$result = $query
->execute();
foreach ($result as $group) {
$matches[$group->group_name] = check_plain($group->group_name);
}
}
drupal_json_output($matches);
}