Projet

Général

Profil

Paste
Télécharger (717 octets) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / views / modules / node / views_handler_field_node_version_count.inc @ 5d12d676

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
}