protected function FieldOrLanguageJoin::joinAddExtra in Drupal 10
Same name and namespace in other branches
- 8 core/modules/views/src/Plugin/views/join/FieldOrLanguageJoin.php \Drupal\views\Plugin\views\join\FieldOrLanguageJoin::joinAddExtra()
- 9 core/modules/views/src/Plugin/views/join/FieldOrLanguageJoin.php \Drupal\views\Plugin\views\join\FieldOrLanguageJoin::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.
Overrides JoinPluginBase::joinAddExtra
File
- core/
modules/ views/ src/ Plugin/ views/ join/ FieldOrLanguageJoin.php, line 69
Class
- FieldOrLanguageJoin
- Implementation for the "field OR language" join.
Namespace
Drupal\views\Plugin\views\joinCode
protected function joinAddExtra(&$arguments, &$condition, $table, SelectInterface $select_query, $left_table = NULL) {
if (empty($this->extra)) {
return;
}
if (is_array($this->extra)) {
$extras = [];
foreach ($this->extra as $extra) {
$extras[] = $this
->buildExtra($extra, $arguments, $table, $select_query, $left_table);
}
// Remove and store the langcode OR bundle join condition extra.
$language_bundle_conditions = [];
foreach ($extras as $key => $extra) {
if (strpos($extra, '.langcode') !== FALSE || strpos($extra, '.bundle') !== FALSE) {
$language_bundle_conditions[] = $extra;
unset($extras[$key]);
}
}
if (count($extras) > 1) {
$condition .= ' AND (' . implode(' ' . $this->extraOperator . ' ', $extras) . ')';
}
elseif ($extras) {
$condition .= ' AND ' . array_shift($extras);
}
// Tack on the langcode OR bundle join condition extra.
if (!empty($language_bundle_conditions)) {
$condition .= ' AND (' . implode(' OR ', $language_bundle_conditions) . ')';
}
}
elseif (is_string($this->extra)) {
$condition .= " AND ({$this->extra})";
}
}