function comment_views_data_alter
Same name in other branches
- 7.x-3.x modules/comment.views.inc \comment_views_data_alter()
Use views_data_alter to add items to the node table that are relevant to comments.
Related topics
File
-
modules/
comment.views.inc, line 473
Code
function comment_views_data_alter(&$data) {
// new comments
$data['node']['new_comments'] = array(
'title' => t('New comments'),
'help' => t('The number of new comments on the node.'),
'field' => array(
'handler' => 'views_handler_field_node_new_comments',
'no group by' => TRUE,
),
);
$data['node']['comments_link'] = array(
'field' => array(
'title' => t('Add comment link'),
'help' => t('Display the standard add comment link used on regular nodes, which will only display if the viewing user has access to add a comment.'),
'handler' => 'views_handler_field_comment_node_link',
),
);
// Comment status of the node
$data['node']['comment'] = array(
'title' => t('Comment status'),
'help' => t('Whether comments are enabled or disabled on the node.'),
'field' => array(
'handler' => 'views_handler_field_node_comment',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'filter' => array(
'handler' => 'views_handler_filter_node_comment',
),
);
$data['node']['uid_touch'] = array(
'title' => t('User posted or commented'),
'help' => t('Display nodes only if a user posted the node or commented on the node.'),
'argument' => array(
'field' => 'uid',
'name table' => 'users',
'name field' => 'name',
'handler' => 'views_handler_argument_comment_user_uid',
),
'filter' => array(
'field' => 'uid',
'name table' => 'users',
'name field' => 'name',
'handler' => 'views_handler_filter_comment_user_uid',
),
);
}