You are here

public function HistoryUserTimestamp::init in Views (for Drupal 7) 8.3

Overrides Drupal\views\Plugin\views\HandlerBase::init().

Overrides Node::init

File

lib/Views/node/Plugin/views/field/HistoryUserTimestamp.php, line 29
Definition of Views\node\Plugin\views\field\HistoryUserTimestamp.

Class

HistoryUserTimestamp
Field handler to display the marker for new content.

Namespace

Views\node\Plugin\views\field

Code

public function init(ViewExecutable $view, &$options) {
  parent::init($view, $options);
  global $user;
  if ($user->uid) {
    $this->additional_fields['created'] = array(
      'table' => 'node',
      'field' => 'created',
    );
    $this->additional_fields['changed'] = array(
      'table' => 'node',
      'field' => 'changed',
    );
    if (module_exists('comment') && !empty($this->options['comments'])) {
      $this->additional_fields['last_comment'] = array(
        'table' => 'node_comment_statistics',
        'field' => 'last_comment_timestamp',
      );
    }
  }
}