function globallink_select_id_callback in GlobalLink Connect for Drupal 7.7
1 string reference to 'globallink_select_id_callback'
- globallink_menu in ./
globallink.module - Implements hook_menu().
File
- ./
globallink_send_translations.inc, line 1033
Code
function globallink_select_id_callback() {
module_load_include('inc', 'globallink', 'globallink');
$payload = json_decode($_POST['payload']);
$val = $payload->id;
$key = $payload->sessionKey;
if ($payload->checked) {
if (isset($_SESSION[$key])) {
if (!in_array($val, $_SESSION[$key])) {
$_SESSION[$key][$val] = $val;
}
}
else {
$_SESSION[$key] = [
$val => $val,
];
}
}
else {
if (isset($_SESSION[$key])) {
if (in_array($val, $_SESSION[$key])) {
unset($_SESSION[$key][$val]);
}
}
}
$count = get_cart_count();
return drupal_json_output(array(
'count' => $count,
));
}