function votingapi_load_content in Voting API 5
A helper function that loads content from type/id pairs.
Parameters
$content_type: The content type to be loaded. node, comment, aggregator-item, user and term are supported.
$content_id: The key id of the content to be loaded.
Return value
The loaded content type.
File
- ./
votingapi.module, line 576
Code
function votingapi_load_content($content_id = 0, $content_type = 'node') {
switch ($content_type) {
case 'node':
$content = node_load($content_id);
break;
case 'comment':
$content = _comment_load($content_id);
break;
case 'aggregator-item':
$result = db_query('SELECT * FROM {aggregator_item} WHERE iid = %d', $content_id);
$content = db_fetch_object($result);
break;
case 'user':
$content = user_load(array(
'uid' => $content_id,
));
break;
case 'term':
$content = taxonomy_get_term($content_id);
break;
}
return $content;
}