You are here

function menu_position_menu_position_condition_taxonomy in Menu Position 6

Same name and namespace in other branches
  1. 7.2 plugins/menu_position.taxonomy.inc \menu_position_menu_position_condition_taxonomy()
  2. 7 plugins/menu_position.taxonomy.inc \menu_position_menu_position_condition_taxonomy()

Checks if a specific taxonomy term is set in the node.

Parameters

$variables: An array containing each of the variables saved in the database necessary to evaluate this condition of the rule.

Return value

TRUE if condition applies successfully. Otherwise FALSE.

File

plugins/menu_position.taxonomy.inc, line 16
Provides the "Taxonomy" rule plugin for the Menu Position module.

Code

function menu_position_menu_position_condition_taxonomy($variables) {

  // Grab the variables stored statically in the rule.
  $tid = $variables['tid'];

  // $node is dynamically added and may not exist.
  $node = isset($variables['context']['node']) ? $variables['context']['node'] : NULL;
  return $node && in_array($tid, array_keys($node->taxonomy)) ? TRUE : FALSE;
}