class views_join_term_edge in Taxonomy Edge 7
Same name and namespace in other branches
- 8 views_taxonomy_edge/handlers/views_join_term_edge.inc \views_join_term_edge
- 6 views_taxonomy_edge/handlers/views_join_term_edge.inc \views_join_term_edge
- 7.2 views_taxonomy_edge/handlers/views_join_term_edge.inc \views_join_term_edge
@file Views join handler for taxonomy edge.
Hierarchy
- class \views_join
- class \views_join_term_edge
Expanded class hierarchy of views_join_term_edge
2 string references to 'views_join_term_edge'
- views_taxonomy_edge_views_data in views_taxonomy_edge/
views_taxonomy_edge.views.inc - Implements hook_views_data().
- views_taxonomy_edge_views_data_alter in views_taxonomy_edge/
views_taxonomy_edge.module - Implements hook_views_data_alter().
File
- views_taxonomy_edge/
handlers/ views_join_term_edge.inc, line 7 - Views join handler for taxonomy edge.
View source
class views_join_term_edge extends views_join {
/**
* Override build_join.
*/
function build_join($select_query, $table, $view_query) {
$this->extra = $table['alias'] . '.vid = ' . $this->left_table . '.vid';
$found = FALSE;
// If there's a condition on parent, then let it be unless it's blank.
// If it's blank we set it to the root of the tree.
foreach ($view_query->where as $data) {
foreach ($data['conditions'] as $condition) {
if (preg_match('/^' . $table['alias'] . '.parent($|\\s*=)/', $condition['field'])) {
if ($condition['value'] == '') {
$condition['value'] = 0;
}
else {
$found = TRUE;
break;
}
}
}
}
// If there wasn't any where conditions on the parent, go through all joins
// to check if there is a join on the parent.
if (!$found) {
foreach ($view_query->table_queue as $queue_table) {
if ($queue_table['table'] == 'taxonomy_term_data') {
if (!empty($queue_table['join']) && $queue_table['join']->left_field == 'parent') {
$found = TRUE;
break;
}
}
elseif ($queue_table['table'] == 'taxonomy_term_edge') {
if (!empty($queue_table['join']) && $queue_table['join']->field == 'parent') {
$found = TRUE;
break;
}
}
}
}
// If no condition on parent was found, add the root pid as a condition.
if (!$found) {
$view_query
->add_where_expression(0, $table['alias'] . '.parent = :parent', array(
':parent' => 0,
));
}
parent::build_join($select_query, $table, $view_query);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
views_join:: |
public | property | ||
views_join:: |
public | property | ||
views_join:: |
public | property | ||
views_join:: |
public | property | ||
views_join:: |
public | property | ||
views_join:: |
public | property | ||
views_join:: |
public | property | ||
views_join:: |
public | function | Construct the views_join object. | 1 |
views_join_term_edge:: |
function |
Override build_join. Overrides views_join:: |