| 59 |
$nid = arg(1); |
$nid = arg(1); |
| 60 |
} // if there's an nid to get |
} // if there's an nid to get |
| 61 |
|
|
| 62 |
|
$term = null; |
| 63 |
|
$vid = $filter['value'][0]; |
| 64 |
if (!is_null($nid)) { |
if (!is_null($nid)) { |
|
$vid = $filter['value'][0]; |
|
| 65 |
$terms = array_keys(taxonomy_node_get_terms_by_vocabulary($nid, $vid)); |
$terms = array_keys(taxonomy_node_get_terms_by_vocabulary($nid, $vid)); |
| 66 |
$term = $terms[0]; |
$term = $terms[0]; |
| 67 |
|
} |
| 68 |
|
|
| 69 |
_views_add_taxonomy($filter['operator'], array($term), $filter['options'], $query); |
if (is_null($term)) { |
| 70 |
|
if (!empty($filter['options'])) { |
| 71 |
|
$terms = taxonomy_get_term_by_name($filter['options']); |
| 72 |
|
foreach ($terms as $myterm) { |
| 73 |
|
if ($myterm->vid == $vid) |
| 74 |
|
$term = $myterm->tid; |
| 75 |
|
break; |
| 76 |
|
} |
| 77 |
|
} else { |
| 78 |
|
// No term and no default = no results. |
| 79 |
|
$query->where[] = "0"; |
| 80 |
|
} |
| 81 |
|
} |
| 82 |
|
|
| 83 |
$query->where[] = "node.nid != '%s'"; |
_views_add_taxonomy($filter['operator'], array($term), 0, $query); |
| 84 |
$query->where_args[] = $nid; |
|
| 85 |
} // if we've got a node |
$query->where[] = "node.nid != '%s'"; |
| 86 |
|
$query->where_args[] = $nid; |
| 87 |
|
|
|
// if there is no node, the view shouldn't return anything. |
|
|
if (is_null($nid)) { |
|
|
$query->where[] = "0"; |
|
|
} // if there is no node |
|
| 88 |
} // function relatedviews_handler_filter_taxcurnode |
} // function relatedviews_handler_filter_taxcurnode |