function _sheetnode_ajax_token in Sheetnode 6
Same name and namespace in other branches
- 7.2 sheetnode.module \_sheetnode_ajax_token()
- 7 sheetnode.module \_sheetnode_ajax_token()
AJAX function to return a token value.
1 string reference to '_sheetnode_ajax_token'
- sheetnode_menu in ./
sheetnode.module - Implementation of hook_menu().
File
- ./
sheetnode.module, line 990
Code
function _sheetnode_ajax_token($oid = NULL, $entity_type = NULL, $token = NULL) {
if (!$oid) {
$oid = $_REQUEST['oid'];
}
if (!$entity_type) {
$entity_type = $_REQUEST['entity_type'];
}
if (!$token) {
$token = $_REQUEST['token'];
}
$value = NULL;
$entity = _sheetnode_load_entity($entity_type, $oid);
if ($entity) {
// Do the token replacement.
if (module_exists('token')) {
$value = token_replace($token, $entity_type, $entity);
}
// If found, send it back.
if ($value) {
drupal_json(array(
'type' => is_numeric($value) ? 'n' : 'th',
'value' => $value,
));
exit;
}
}
drupal_json(array(
'value' => '',
'type' => 'e#NAME?',
));
exit;
}