You are here

class LastTimestamp in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/comment/src/Plugin/views/field/LastTimestamp.php \Drupal\comment\Plugin\views\field\LastTimestamp
  2. 9 core/modules/comment/src/Plugin/views/field/LastTimestamp.php \Drupal\comment\Plugin\views\field\LastTimestamp

Field handler to display the timestamp of a comment with the count of comments.

Plugin annotation

@ViewsField("comment_last_timestamp");

Hierarchy

  • class \Drupal\views\Plugin\views\field\Date extends \Drupal\views\Plugin\views\field\FieldPluginBase

Expanded class hierarchy of LastTimestamp

File

core/modules/comment/src/Plugin/views/field/LastTimestamp.php, line 17

Namespace

Drupal\comment\Plugin\views\field
View source
class LastTimestamp extends Date {

  /**
   * {@inheritdoc}
   */
  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
    parent::init($view, $display, $options);
    $this->additional_fields['comment_count'] = 'comment_count';
  }

  /**
   * {@inheritdoc}
   */
  public function render(ResultRow $values) {
    $comment_count = $this
      ->getValue($values, 'comment_count');
    if (empty($this->options['empty_zero']) || $comment_count) {
      return parent::render($values);
    }
    else {
      return NULL;
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Date::$dateFormatStorage protected property The date format storage.
Date::$dateFormatter protected property The date formatter service.
Date::buildOptionsForm public function
Date::create public static function
Date::defineOptions protected function
Date::__construct public function Constructs a new Date object.
LastTimestamp::init public function
LastTimestamp::render public function Overrides Date::render