public function HistoryUserTimestamp::init

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

Overrides Node::init

File

drupal/core/modules/node/lib/Drupal/node/Plugin/views/field/HistoryUserTimestamp.php, line 29
Definition of Drupal\node\Plugin\views\field\HistoryUserTimestamp.

Class

HistoryUserTimestamp
Field handler to display the marker for new content.

Namespace

Drupal\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',
      );
    }
  }
}