You are here

public function HistoryUserTimestamp::init in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php \Drupal\history\Plugin\views\field\HistoryUserTimestamp::init()

Initialize the plugin.

Parameters

\Drupal\views\ViewExecutable $view: The view object.

\Drupal\views\Plugin\views\display\DisplayPluginBase $display: The display handler.

array $options: The options configured for this plugin.

Overrides Node::init

File

core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php, line 38
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);
  if (\Drupal::currentUser()
    ->isAuthenticated()) {
    $this->additional_fields['created'] = array(
      'table' => 'node_field_data',
      'field' => 'created',
    );
    $this->additional_fields['changed'] = array(
      'table' => 'node_field_data',
      'field' => 'changed',
    );
    if (\Drupal::moduleHandler()
      ->moduleExists('comment') && !empty($this->options['comments'])) {
      $this->additional_fields['last_comment'] = array(
        'table' => 'comment_entity_statistics',
        'field' => 'last_comment_timestamp',
      );
    }
  }
}