You are here

function _power_menu_get_node_location_taxonomy in Power Menu 7

Same name and namespace in other branches
  1. 6 power_menu.module \_power_menu_get_node_location_taxonomy()

Parameters

$node:

$current_menu:

2 calls to _power_menu_get_node_location_taxonomy()
power_menu_node_location in ./power_menu.module
Determine the menu location of a node.
power_menu_tokens in ./power_menu.module
Implements hook_tokens().

File

./power_menu.module, line 367
This module provides some additional menu features. The features are not actually new, but are part of other modules. it's though very cumbersome to creating a new menu item, because one has to go to all the different places to configure these…

Code

function _power_menu_get_node_location_taxonomy($node, $current_power_menu) {
  $taxonomy_field = 'field_' . variable_get('power_menu_taxonomy_field', '');
  if (!empty($taxonomy_field) && !empty($node->{$taxonomy_field})) {
    $terms = field_get_items('node', $node, $taxonomy_field);
    if ($terms) {
      return db_query("SELECT path FROM {power_menu} WHERE tid = :tid AND menu_name = :menu_name", array(
        ':tid' => $terms[0]['tid'],
        ':menu_name' => $current_power_menu,
      ))
        ->fetchField();
    }
  }
  return NULL;
}