Version 1
[yaffs-website] / web / core / modules / views / tests / modules / views_test_data / src / Plugin / views / join / JoinTest.php
diff --git a/web/core/modules/views/tests/modules/views_test_data/src/Plugin/views/join/JoinTest.php b/web/core/modules/views/tests/modules/views_test_data/src/Plugin/views/join/JoinTest.php
new file mode 100644 (file)
index 0000000..b57c970
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+
+namespace Drupal\views_test_data\Plugin\views\join;
+
+use Drupal\views\Plugin\views\join\JoinPluginBase;
+
+/**
+ * Defines a join test plugin.
+ *
+ * @ViewsJoin("join_test")
+ */
+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
+   */
+  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);
+  }
+
+}