function userpoints_operation_autocomplete in User Points 7
Same name and namespace in other branches
- 7.2 userpoints.admin.inc \userpoints_operation_autocomplete()
Autocomplete callback for search an operation.
Parameters
$search: Search string.
1 string reference to 'userpoints_operation_autocomplete'
- userpoints_menu in ./
userpoints.module - Implements hook_menu().
File
- ./
userpoints.admin.inc, line 247 - Admin menu callbacks for userpoints.module.
Code
function userpoints_operation_autocomplete($search) {
$results = array();
if (!empty($search)) {
foreach (userpoints_get_info() as $operation => $info) {
if (strpos($operation, $search) !== FALSE) {
$results[$operation] = userpoints_create_operation_autocomplete_label($operation, $info, $search);
}
elseif (isset($info['admin description']) && strpos($info['admin description'], $search) !== FALSE) {
$results[$operation] = userpoints_create_operation_autocomplete_label($operation, $info, $search);
}
elseif (isset($info['description']) && strpos($info['description'], $search) !== FALSE) {
$results[$operation] = userpoints_create_operation_autocomplete_label($operation, $info, $search);
}
}
}
drupal_json_output((object) $results);
}