function _token_get_id in Token 6
Same name and namespace in other branches
- 5 token.module \_token_get_id()
A helper function to return an object's ID for use in static caching.
2 calls to _token_get_id()
- token_get_values in ./
token.module - Return a list of valid substitution tokens and their values for the specified type.
- token_rules_input_evaluator_apply in ./
token.rules.inc - Apply the input evaluator.
File
- ./
token.module, line 469 - 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->vid) ? $object->vid : (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));
}
}