function content_profile_views_handler_relationship::query in Content Profile 6
Called to implement a relationship in a query.
File
- views/
content_profile_views_handler_relationship.inc, line 33
Class
- content_profile_views_handler_relationship
- Specialized relationship handler to adding content profiles.
Code
function query() {
// Figure out what base table this relationship brings to the party.
$join = new views_join();
$join->definition = array(
'table' => 'node',
'field' => 'uid',
'left_table' => !empty($this->relationship) ? $this->relationship : 'users',
'left_field' => 'uid',
'extra' => array(
array(
'field' => 'type',
'value' => $this->options['type'],
),
),
);
if (!empty($this->options['required'])) {
$join->definition['type'] = 'INNER';
}
$join
->construct();
$this
->ensure_my_table();
$alias = $join->definition['table'] . '_' . $join->definition['left_table'];
$this->alias = $this->query
->add_relationship($alias, $join, $this->definition['base'], $this->relationship);
}