Handlers to tell Views how to join tables together.
Here is an example how to join from table one to example two so it produces the following sql:
INNER JOIN {two} ON one.field_a = two.field_b
@code.
The required php code for this kind of functionality is the following:
@code
$configuration = array(
'table' => 'two',
'field' => 'field_b',
'left_table' => 'one',
'left_field' => 'field_a',
'operator' => '='
);
$join = drupal_container()->get('plugin.manager.views.join')->createInstance('standard', $configuration);
Here is how you do complex joins:
@code
class JoinComplex extends JoinPluginBase {
public function buildJoin($select_query, $table, $view_query) {
// Add an additional hardcoded condition to the query.
$this->extra = 'foo.bar = baz.boing';
parent::buildJoin($select_query, $table, $view_query);
}
}
Name | Location | Description |
---|---|---|
JoinPluginBase |
drupal/ |
Represents a join and creates the SQL necessary to implement the join. |