public function views_handler_field_comment_node_link::render in Views (for Drupal 7) 7.3
Same name and namespace in other branches
- 6.3 modules/comment/views_handler_field_comment_node_link.inc \views_handler_field_comment_node_link::render()
- 6.2 modules/comment/views_handler_field_comment_node_link.inc \views_handler_field_comment_node_link::render()
Render the field.
Parameters
array $values: The values retrieved from the database.
Overrides views_handler_field::render
File
- modules/
comment/ views_handler_field_comment_node_link.inc, line 67 - Definition of views_handler_field_comment_node_link.
Class
- views_handler_field_comment_node_link
- Handler for showing comment module's node link.
Code
public function render($values) {
// Build fake $node.
$node = $this
->get_value($values);
// Call comment.module's hook_link:
// comment_link($type, $node = NULL, $teaser = FALSE)
// Call node by reference so that something is changed here.
comment_node_view($node, $this->options['teaser'] ? 'teaser' : 'full');
// Question: should we run these through:
// drupal_alter('link', $links, $node);
// Might this have unexpected consequences if these hooks expect items in
// $node that we don't have?
// Only render the links, if they are defined.
return !empty($node->content['links']['comment']) ? drupal_render($node->content['links']['comment']) : '';
}