You are here

protected function JoinPluginBase::joinAddExtra in Drupal 8

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()

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.

1 call to JoinPluginBase::joinAddExtra()
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 334

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})";
  }
}