public function HistoryUserTimestamp::init

Overrides \Drupal\node\Plugin\views\field\Node::init().

Overrides Node::init

File

drupal/core/modules/history/lib/Drupal/history/Plugin/views/field/HistoryUserTimestamp.php, line 30
Contains \Drupal\history\Plugin\views\field\HistoryUserTimestamp.

Class

HistoryUserTimestamp
Field handler to display the marker for new content.

Namespace

Drupal\history\Plugin\views\field

Code

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