function nodereferrer_view_handler_relationship::ensure_my_table in NodeReferrer 6
Same name and namespace in other branches
- 7 views/nodereferrer_view_handler_relationship.inc \nodereferrer_view_handler_relationship::ensure_my_table()
1 call to nodereferrer_view_handler_relationship::ensure_my_table()
- nodereferrer_view_handler_relationship::query in views/
nodereferrer_view_handler_relationship.inc - Called to implement a relationship in a query.
File
- views/
nodereferrer_view_handler_relationship.inc, line 50 - nodereferrer.module Views integration
Class
- nodereferrer_view_handler_relationship
- @file nodereferrer.module Views integration
Code
function ensure_my_table() {
if (!isset($this->table_alias)) {
$fieldname = $this->options['referrer_field'];
$field = content_fields($fieldname);
$db_info = content_database_info($field);
$join = new views_join();
$join
->construct($db_info['table'], 'node', 'nid', $db_info['columns']['nid']['column']);
// Add delta condition.
if (!isset($join->extra)) {
$join->extra = array();
}
$delta = isset($this->options['referrer_delta']) ? $this->options['referrer_delta'] : -1;
if ($delta != -1) {
$join->extra[] = array(
'field' => 'delta',
'value' => $delta,
'numeric' => TRUE,
);
}
$this->table_alias = $this->query
->add_table($this->table, $this->relationship, $join);
}
return $this->table_alias;
}