1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Definition of views_handler_sort_node_version_count.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* A handler that sorts on the total count of versions/revisions of a node.
|
10
|
*
|
11
|
* @ingroup views_sort_handlers
|
12
|
*/
|
13
|
class views_handler_sort_node_version_count extends views_handler_sort {
|
14
|
|
15
|
/**
|
16
|
* {@inheritdoc}
|
17
|
*/
|
18
|
public function query() {
|
19
|
$this->ensure_my_table();
|
20
|
|
21
|
$this->query->add_orderby(NULL, '(SELECT COUNT(vid) FROM {node_revision} WHERE nid = {' . $this->table_alias . '}.nid)', $this->options['order'], 'sort_node_version_count');
|
22
|
}
|
23
|
|
24
|
}
|