function token_entity_load in Examples for Developers 6
Related topics
1 call to token_entity_load()
- token_example_example_form in token_example/
token_example.module - Form builder; display lists of supported token entities and text to tokenize.
File
- token_example/
token_example.module, line 146 - The Token API module.
Code
function token_entity_load($entity_type, $entity_id) {
switch ($entity_type) {
case 'node':
return node_load($entity_id);
case 'comment':
$sql = 'SELECT c.cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, c.homepage, u.uid, u.name AS registered_name, u.signature, u.signature_format, u.picture, u.data, c.status FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = %d';
return db_fetch_object(db_query($sql, $entity_id));
case 'user':
return user_load($entity_id);
}
}