You are here

views_join_term_edge.inc in Taxonomy Edge 6

File

views_taxonomy_edge/handlers/views_join_term_edge.inc
View source
<?php

/**
 * @file
 */
class views_join_term_edge extends views_join {
  function join($table, &$query) {
    $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 ($query->where as $data) {
      foreach ($data['clauses'] as $condition) {
        if (strpos($condition, $table['alias'] . '.parent ') !== FALSE) {
          $found = TRUE;
          break;
        }
      }
    }
    $result = parent::join($table, $query);
    $result .= ' AND ' . $table['alias'] . '.vid = ' . $this->left_table . '.vid';

    // If no condition on parent was found, add the root pid as a condition.
    if (!$found) {
      $result .= ' AND ' . $table['alias'] . '.parent = 0 ';
    }
    return $result;
  }

}

Classes

Namesort descending Description
views_join_term_edge @file