function uc_coupon_autocomplete_term in Ubercart Discount Coupons 7.2
Same name and namespace in other branches
- 5 uc_coupon.module \uc_coupon_autocomplete_term()
- 6 uc_coupon.admin.inc \uc_coupon_autocomplete_term()
- 7.3 uc_coupon.admin.inc \uc_coupon_autocomplete_term()
Autocomplete callback for term restrictions.
1 string reference to 'uc_coupon_autocomplete_term'
- uc_coupon_menu in ./
uc_coupon.module - Implements hook_menu().
File
- ./
uc_coupon.admin.inc, line 912 - Discount Coupons administration pages.
Code
function uc_coupon_autocomplete_term($string) {
$matches = array();
$result = db_query("SELECT tid, name FROM {taxonomy_term_data} WHERE name LIKE :name", array(
':name' => "%{$string}%",
));
foreach ($result as $row) {
$matches[$row->name . ' [tid:' . $row->tid . ']'] = $row->name;
}
print drupal_json_encode($matches);
exit;
}