function _token_get_id in Token 5
Same name and namespace in other branches
- 6 token.module \_token_get_id()
1 call to _token_get_id()
- token_get_values in ./
token.module - Return a list of valid substitution tokens and their values for the specified type.
File
- ./
token.module, line 422 - The Token API module.
Code
function _token_get_id($type = 'global', $object = NULL) {
if (!isset($object)) {
return "default";
}
switch ($type) {
case 'node':
return isset($object->nid) ? $object->nid : 0;
case 'comment':
return isset($object->cid) ? $object->cid : 0;
case 'user':
return isset($object->uid) ? $object->uid : 0;
case 'taxonomy':
return isset($object->tid) ? $object->tid : 0;
default:
return crc32(serialize($object));
}
}