function entity_metadata_comment_get_properties in Entity API 7
Callback for getting comment properties.
See also
entity_metadata_comment_entity_info_alter()
1 string reference to 'entity_metadata_comment_get_properties'
- entity_metadata_comment_entity_property_info in modules/
comment.info.inc - Implements hook_entity_property_info() on top of comment module.
File
- modules/
callbacks.inc, line 47 - Provides various callbacks for the whole core module integration.
Code
function entity_metadata_comment_get_properties($comment, array $options, $name) {
switch ($name) {
case 'name':
return $comment->name;
case 'mail':
if ($comment->uid != 0) {
$account = user_load($comment->uid);
return $account->mail;
}
return $comment->mail;
case 'edit_url':
return url('comment/edit/' . $comment->cid, $options);
case 'parent':
if (!empty($comment->pid)) {
return $comment->pid;
}
// There is no parent comment.
return NULL;
}
}