JoinTest.php

Same filename in this branch
  1. 11.x core/modules/views/tests/src/Kernel/Plugin/JoinTest.php
Same filename in other branches
  1. 9 core/modules/views/tests/src/Kernel/Plugin/JoinTest.php
  2. 9 core/modules/views/tests/modules/views_test_data/src/Plugin/views/join/JoinTest.php
  3. 8.9.x core/modules/views/tests/src/Kernel/Plugin/JoinTest.php
  4. 8.9.x core/modules/views/tests/modules/views_test_data/src/Plugin/views/join/JoinTest.php
  5. 10 core/modules/views/tests/src/Kernel/Plugin/JoinTest.php
  6. 10 core/modules/views/tests/modules/views_test_data/src/Plugin/views/join/JoinTest.php

Namespace

Drupal\views_test_data\Plugin\views\join

File

core/modules/views/tests/modules/views_test_data/src/Plugin/views/join/JoinTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\views_test_data\Plugin\views\join;

use Drupal\views\Attribute\ViewsJoin;
use Drupal\views\Plugin\views\join\JoinPluginBase;

/**
 * Defines a join test plugin.
 */
class JoinTest extends JoinPluginBase {
    
    /**
     * A value which is used to build an additional join condition.
     *
     * @var int
     */
    protected $joinValue;
    
    /**
     * Returns the joinValue property.
     *
     * @return int
     */
    public function getJoinValue() {
        return $this->joinValue;
    }
    
    /**
     * Sets the joinValue property.
     *
     * @param int $join_value
     *   The value of the join.
     */
    public function setJoinValue($join_value) {
        $this->joinValue = $join_value;
    }
    
    /**
     * {@inheritdoc}
     */
    public function buildJoin($select_query, $table, $view_query) {
        // Add an additional hardcoded condition to the query.
        $this->extra = 'views_test_data.uid = ' . $this->getJoinValue();
        parent::buildJoin($select_query, $table, $view_query);
    }

}

Classes

Title Deprecated Summary
JoinTest Defines a join test plugin.

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