function JoinPluginBase::joinAddExtra

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/join/JoinPluginBase.php \Drupal\views\Plugin\views\join\JoinPluginBase::joinAddExtra()
  2. 8.9.x core/modules/views/src/Plugin/views/join/JoinPluginBase.php \Drupal\views\Plugin\views\join\JoinPluginBase::joinAddExtra()
  3. 10 core/modules/views/src/Plugin/views/join/JoinPluginBase.php \Drupal\views\Plugin\views\join\JoinPluginBase::joinAddExtra()

Adds the extras to the join condition.

Parameters

array $arguments: Array of query arguments.

string $condition: The condition to be built.

array $table: The right table.

\Drupal\Core\Database\Query\SelectInterface $select_query: The current select query being built.

array $left_table: The left table.

2 calls to JoinPluginBase::joinAddExtra()
CastedIntFieldJoin::buildJoin in core/modules/views/src/Plugin/views/join/CastedIntFieldJoin.php
Builds the SQL for the join this object represents.
JoinPluginBase::buildJoin in core/modules/views/src/Plugin/views/join/JoinPluginBase.php
Builds the SQL for the join this object represents.
1 method overrides JoinPluginBase::joinAddExtra()
FieldOrLanguageJoin::joinAddExtra in core/modules/views/src/Plugin/views/join/FieldOrLanguageJoin.php
Adds the extras to the join condition.

File

core/modules/views/src/Plugin/views/join/JoinPluginBase.php, line 339

Class

JoinPluginBase
Represents a join and creates the SQL necessary to implement the join.

Namespace

Drupal\views\Plugin\views\join

Code

protected function joinAddExtra(&$arguments, &$condition, $table, SelectInterface $select_query, $left_table = NULL) {
    if (is_array($this->extra)) {
        $extras = [];
        foreach ($this->extra as $info) {
            $extras[] = $this->buildExtra($info, $arguments, $table, $select_query, $left_table);
        }
        if ($extras) {
            if (count($extras) == 1) {
                $condition .= ' AND ' . array_shift($extras);
            }
            else {
                $condition .= ' AND (' . implode(' ' . $this->extraOperator . ' ', $extras) . ')';
            }
        }
    }
    elseif ($this->extra && is_string($this->extra)) {
        $condition .= " AND ({$this->extra})";
    }
}

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