public function TaxonomyIndexTid::init

Same name in this branch

Overrides \Drupal\views\Plugin\views\field\PrerenderList::init().

Overrides FieldPluginBase::init

File

drupal/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/field/TaxonomyIndexTid.php, line 27
Definition of Drupal\taxonomy\Plugin\views\field\TaxonomyIndexTid.

Class

TaxonomyIndexTid
Field handler to display all taxonomy terms of a node.

Namespace

Drupal\taxonomy\Plugin\views\field

Code

public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
  parent::init($view, $display, $options);

  // @todo: Wouldn't it be possible to use $this->base_table and no if here?
  if ($view->storage
    ->get('base_table') == 'node_field_revision') {
    $this->additional_fields['nid'] = array(
      'table' => 'node_field_revision',
      'field' => 'nid',
    );
  }
  else {
    $this->additional_fields['nid'] = array(
      'table' => 'node',
      'field' => 'nid',
    );
  }
}