function RelationshipPluginBase::query
Same name in other branches
- 9 core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php \Drupal\views\Plugin\views\relationship\RelationshipPluginBase::query()
- 8.9.x core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php \Drupal\views\Plugin\views\relationship\RelationshipPluginBase::query()
- 10 core/modules/views/src/Plugin/views/relationship/RelationshipPluginBase.php \Drupal\views\Plugin\views\relationship\RelationshipPluginBase::query()
Overrides HandlerBase::query
3 methods override RelationshipPluginBase::query()
- EntityReverse::query in core/
modules/ views/ src/ Plugin/ views/ relationship/ EntityReverse.php - Called to implement a relationship in a query.
- GroupwiseMax::query in core/
modules/ views/ src/ Plugin/ views/ relationship/ GroupwiseMax.php - Add anything to the query that we might need to.
- NodeTermData::query in core/
modules/ taxonomy/ src/ Plugin/ views/ relationship/ NodeTermData.php - Called to implement a relationship in a query.
File
-
core/
modules/ views/ src/ Plugin/ views/ relationship/ RelationshipPluginBase.php, line 129
Class
- RelationshipPluginBase
- Relationship plugin base.
Namespace
Drupal\views\Plugin\views\relationshipCode
public function query() {
if (!empty($this->definition['deprecated'])) {
@trigger_error($this->definition['deprecated'], E_USER_DEPRECATED);
}
// Figure out what base table this relationship brings to the party.
$table_data = Views::viewsData()->get($this->definition['base']);
$base_field = empty($this->definition['base field']) ? $table_data['table']['base']['field'] : $this->definition['base field'];
$this->ensureMyTable();
$def = $this->definition;
$def['table'] = $this->definition['base'];
$def['field'] = $base_field;
$def['left_table'] = $this->tableAlias;
$def['left_field'] = $this->realField;
$def['adjusted'] = TRUE;
if (!empty($this->options['required'])) {
$def['type'] = 'INNER';
}
if (!empty($this->definition['extra'])) {
$def['extra'] = $this->definition['extra'];
}
if (!empty($def['join_id'])) {
$id = $def['join_id'];
}
else {
$id = 'standard';
}
$join = Views::pluginManager('join')->createInstance($id, $def);
// Use a short alias for this:
$alias = $def['table'] . '_' . $this->table;
$this->alias = $this->query
->addRelationship($alias, $join, $this->definition['base'], $this->relationship);
// Add access tags if the base table provide it.
if (empty($this->query->options['disable_sql_rewrite']) && isset($table_data['table']['base']['access query tag'])) {
$access_tag = $table_data['table']['base']['access query tag'];
$this->query
->addTag($access_tag);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.