Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. JoinPluginBase.php

function JoinPluginBase::buildJoin

Overrides JoinPluginInterface::buildJoin

2 methods override JoinPluginBase::buildJoin()
CastedIntFieldJoin::buildJoin in core/modules/views/src/Plugin/views/join/CastedIntFieldJoin.php
Builds the SQL for the join this object represents.
Subquery::buildJoin in core/modules/views/src/Plugin/views/join/Subquery.php
Builds the SQL for the join this object represents.

File

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

Class

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

Namespace

Drupal\views\Plugin\views\join

Code

public function buildJoin($select_query, $table, $view_query) {
    if (empty($this->configuration['table formula'])) {
        $right_table = $this->table;
    }
    else {
        $right_table = $this->configuration['table formula'];
    }
    if ($this->leftTable) {
        $left_table = $view_query->getTableInfo($this->leftTable);
        $left_field = $this->leftFormula ?: "{$left_table['alias']}.{$this->leftField}";
    }
    else {
        // This can be used if left_field is a formula or something. It should be used only *very* rarely.
        $left_field = $this->leftField;
        $left_table = NULL;
    }
    $condition = "{$left_field} " . $this->configuration['operator'] . " {$table['alias']}.{$this->field}";
    $arguments = [];
    // Tack on the extra.
    if (isset($this->extra)) {
        $this->joinAddExtra($arguments, $condition, $table, $select_query, $left_table);
    }
    $select_query->addJoin($this->type, $right_table, $table['alias'], $condition, $arguments);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal