You are here

function _document_get_node_terms in Document 7

Same name and namespace in other branches
  1. 6 document.module \_document_get_node_terms()
  2. 8.x document.module \_document_get_node_terms()
2 calls to _document_get_node_terms()
document_insert in ./document.module
Implementation of hook_insert().
document_update in ./document.module
Implementation of hook_update().

File

./document.module, line 691

Code

function _document_get_node_terms($node) {
  if (isset($node->document_types[$node->language])) {
    $input = $node->document_types[$node->language];
  }
  else {
    $input = $node->document_types['und'];
  }
  $term_ids = array();
  if (count($input) > 0) {
    foreach ($input as $term) {
      $term_ids[] = $term['tid'];
    }
  }
  else {
    return '';
  }
  $types = document_get_types(TRUE);
  $terms = array();
  foreach ($term_ids as $id) {
    $terms[] = $types[$id];
  }
  return implode($terms);
}