function views_handler_relationship_fontyourface_tag::query in @font-your-face 7
Same name and namespace in other branches
- 6.2 views/views_handler_relationship_fontyourface_tag.inc \views_handler_relationship_fontyourface_tag::query()
- 7.2 modules/fontyourface_ui/views/views_handler_relationship_fontyourface_tag.inc \views_handler_relationship_fontyourface_tag::query()
Called to implement a relationship in a query.
Overrides views_handler_relationship::query
File
- views/
views_handler_relationship_fontyourface_tag.inc, line 13 - Views handler.
Class
- views_handler_relationship_fontyourface_tag
- @file Views handler.
Code
function query() {
$this
->ensure_my_table();
$def = $this->definition;
$def['table'] = 'fontyourface_tag';
if (!empty($this->options['required'])) {
$tag_font = $this->query
->add_table('fontyourface_tag_font', $this->relationship);
$def['left_table'] = $tag_font;
$def['left_field'] = 'tid';
$def['field'] = 'tid';
if (!empty($this->options['required'])) {
$def['type'] = 'INNER';
}
// if
}
else {
// If the join is optional, join a subselect that will emulate fontyourface_tag_font table instead.
$def['left_table'] = $this->table_alias;
$def['left_field'] = 'fid';
$def['field'] = 'font';
$def['table formula'] = "(\n SELECT t.*, tf.fid AS font\n FROM {fontyourface_tag} t\n INNER JOIN {fontyourface_tag_font} tf\n ON t.tid = tf.tid\n )";
}
// 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, 'fontyourface_tag', $this->relationship);
}