You are here

function _taxonomy_menu_get_node_terms in Taxonomy menu 7.2

Same name and namespace in other branches
  1. 8 taxonomy_menu.database.inc \_taxonomy_menu_get_node_terms()
  2. 6.2 taxonomy_menu.database.inc \_taxonomy_menu_get_node_terms()
  3. 7 taxonomy_menu.database.inc \_taxonomy_menu_get_node_terms()

Get an array of the tid's related to the node

Parameters

$node:

Return value

array of tids

File

./taxonomy_menu.database.inc, line 121
Database functions.

Code

function _taxonomy_menu_get_node_terms($node) {

  // Get the taxonomy fields.
  $tids = array();
  $result = db_query("SELECT field_name FROM {field_config} WHERE type = 'taxonomy_term_reference'");
  foreach ($result as $field) {
    $field_name = $field->field_name;
    if (isset($node->{$field_name})) {
      $tid_field = $node->{$field_name};

      // Loop through all the languages.
      foreach ($tid_field as $tid_field_languages) {

        // Loop through all the tids
        foreach ($tid_field_languages as $tid) {
          $tids[] = $tid['tid'];
        }
      }
    }
  }
  return $tids;
}