function Node::init

Same name and namespace in other branches
  1. 9 core/modules/node/src/Plugin/views/field/Node.php \Drupal\node\Plugin\views\field\Node::init()
  2. 8.9.x core/modules/node/src/Plugin/views/field/Node.php \Drupal\node\Plugin\views\field\Node::init()
  3. 10 core/modules/node/src/Plugin/views/field/Node.php \Drupal\node\Plugin\views\field\Node::init()

Overrides FieldPluginBase::init

1 call to Node::init()
HistoryUserTimestamp::init in core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php
Initialize the plugin.
1 method overrides Node::init()
HistoryUserTimestamp::init in core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php
Initialize the plugin.

File

core/modules/node/src/Plugin/views/field/Node.php, line 28

Class

Node
Field handler to provide simple renderer that allows linking to a node.

Namespace

Drupal\node\Plugin\views\field

Code

public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$options = NULL) {
    parent::init($view, $display, $options);
    // Don't add the additional fields to groupby
    if (!empty($this->options['link_to_node'])) {
        $this->additional_fields['nid'] = [
            'table' => 'node_field_data',
            'field' => 'nid',
        ];
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.