function nodereferrer_view_handler_relationship::query in NodeReferrer 6
Same name and namespace in other branches
- 7 views/nodereferrer_view_handler_relationship.inc \nodereferrer_view_handler_relationship::query()
Called to implement a relationship in a query.
File
- views/
nodereferrer_view_handler_relationship.inc, line 82 - nodereferrer.module Views integration
Class
- nodereferrer_view_handler_relationship
- @file nodereferrer.module Views integration
Code
function query() {
// Figure out what base table this relationship brings to the party.
$table_data = views_fetch_data($this->definition['base']);
$base_field = empty($this->definition['base field']) ? $table_data['table']['base']['field'] : $this->definition['base field'];
$this
->ensure_my_table();
$def = $this->definition;
$def['table'] = $this->definition['base'];
$def['field'] = 'vid';
$def['left_table'] = $this->table_alias;
$def['left_field'] = 'vid';
if (!empty($this->options['required'])) {
$def['type'] = 'INNER';
}
if (!empty($def['join_handler']) && class_exists($def['join_handler'])) {
$join = new $def['join_handler']();
}
else {
$join = new views_join();
}
$join->definition = $def;
$join
->construct();
$join->adjusted = TRUE;
// use a short alias for this:
$alias = $def['table'] . '_' . $this->table;
$this->alias = $this->query
->add_relationship($alias, $join, $this->definition['base'], $this->relationship);
}