3 namespace Drupal\comment\Plugin\views\field;
5 use Drupal\views\Plugin\views\field\Date;
6 use Drupal\views\Plugin\views\display\DisplayPluginBase;
7 use Drupal\views\ResultRow;
8 use Drupal\views\ViewExecutable;
11 * Field handler to display the timestamp of a comment with the count of comments.
13 * @ingroup views_field_handlers
15 * @ViewsField("comment_last_timestamp")
17 class LastTimestamp extends Date {
22 public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
23 parent::init($view, $display, $options);
25 $this->additional_fields['comment_count'] = 'comment_count';
31 public function render(ResultRow $values) {
32 $comment_count = $this->getValue($values, 'comment_count');
33 if (empty($this->options['empty_zero']) || $comment_count) {
34 return parent::render($values);