views_handler_field_node_version_count.inc 676 B

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