public function Comment::init

Override init function to provide generic option to link to comment.

Overrides FieldPluginBase::init

File

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

Class

Comment
Field handler to allow linking to a comment.

Namespace

Drupal\comment\Plugin\views\field

Code

public function init(ViewExecutable $view, &$options) {
  parent::init($view, $options);
  if (!empty($this->options['link_to_comment'])) {
    $this->additional_fields['cid'] = 'cid';
    $this->additional_fields['nid'] = 'nid';
  }
}