views_handler_field_last_comment_timestamp.inc 737 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * @file
  4. * Definition of views_handler_field_last_comment_timestamp.
  5. */
  6. /**
  7. * Field handler to display the timestamp of a comment with the comments count.
  8. *
  9. * @ingroup views_field_handlers
  10. */
  11. class views_handler_field_last_comment_timestamp extends views_handler_field_date {
  12. /**
  13. * {@inheritdoc}
  14. */
  15. public function construct() {
  16. parent::construct();
  17. $this->additional_fields['comment_count'] = 'comment_count';
  18. }
  19. /**
  20. * {@inheritdoc}
  21. */
  22. public function render($values) {
  23. $comment_count = $this->get_value($values, 'comment_count');
  24. if (empty($this->options['empty_zero']) || $comment_count) {
  25. return parent::render($values);
  26. }
  27. else {
  28. return NULL;
  29. }
  30. }
  31. }