function RelationshipPluginBase::init

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php \Drupal\views\Plugin\views\relationship\RelationshipPluginBase::init()
  2. 10 core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php \Drupal\views\Plugin\views\relationship\RelationshipPluginBase::init()
  3. 11.x core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php \Drupal\views\Plugin\views\relationship\RelationshipPluginBase::init()

Overrides \Drupal\views\Plugin\views\HandlerBase::init().

Init handler to let relationships live on tables other than the table they operate on.

Overrides HandlerBase::init

1 call to RelationshipPluginBase::init()
NodeTermData::init in core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php
1 method overrides RelationshipPluginBase::init()
NodeTermData::init in core/modules/taxonomy/src/Plugin/views/relationship/NodeTermData.php

File

core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php, line 64

Class

RelationshipPluginBase
Simple relationship handler that allows a new version of the primary table to be linked in.

Namespace

Drupal\views\Plugin\views\relationship

Code

public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
    parent::init($view, $display, $options);
    if (isset($this->definition['relationship table'])) {
        $this->table = $this->definition['relationship table'];
    }
    if (isset($this->definition['relationship field'])) {
        // Set both realField and field so custom handler can rely on the old
        // field value.
        $this->realField = $this->field = $this->definition['relationship field'];
    }
}

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