function headerimage_eval_taxonomy in Header image 7
Same name and namespace in other branches
- 5 headerimage.module \headerimage_eval_taxonomy()
- 6 headerimage.module \headerimage_eval_taxonomy()
Evaluate taxonomy condition
Check if current page has selected taxonomy terms
Parameters
$condition: array of taxonomy term tid's
Return value
true: current page contains one of $condition's tags false: if not null: current page is not a node
1 call to headerimage_eval_taxonomy()
- headerimage_select_node in ./headerimage.module 
- Select a node to be displayed in the block
File
- ./headerimage.module, line 374 
- headerimage.module Conditionally display an node in a block.
Code
function headerimage_eval_taxonomy($condition) {
  if (arg(0) == 'node' && is_numeric(arg(1))) {
    if ($node = menu_get_object()) {
      $query = "SELECT tid FROM {taxonomy_index} WHERE nid = :nid";
      $terms = db_query($query, array(
        ':nid' => $node->nid,
      ))
        ->fetchAllKeyed(0, 0);
      foreach (array_keys($terms) as $key) {
        if (isset($condition[$key])) {
          return true;
        }
      }
      return false;
    }
  }
  return null;
}