1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Definition of views_handler_field_node_version_count.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* A handler that loads the total count of versions/revisions of a certain node.
|
10
|
*
|
11
|
* @ingroup views_field_handlers
|
12
|
*/
|
13
|
class views_handler_field_node_version_count extends views_handler_field_numeric {
|
14
|
|
15
|
/**
|
16
|
* {@inheritdoc}
|
17
|
*/
|
18
|
public function query() {
|
19
|
$this->ensure_my_table();
|
20
|
// Add the field.
|
21
|
$params = $this->options['group_type'] != 'group' ? array('function' => $this->options['group_type']) : array();
|
22
|
$this->field_alias = $this->query->add_field(NULL, '(SELECT COUNT(vid) FROM {node_revision} WHERE nid = {node}.nid)', 'node_version_count', $params);
|
23
|
|
24
|
$this->add_additional_fields();
|
25
|
}
|
26
|
|
27
|
}
|