You are here

function _node_import_taxonomy_form2node in Node import 5

Convert the taxonomy array from the form form to the node form.

Form form: $node->taxonomy[$vid] = array($tid, $tid, ...); // multiple select $node->taxonomy[$vid] = $tid; // single select $node->taxonomy['tags'][$vid] = $text; // free tagging

Node form: $node->taxonomy[$tid] = $term_object; // all selects $node->taxonomy['tags'][$vid] = $text; // is handled ok

1 call to _node_import_taxonomy_form2node()
taxonomy_node_import_global in supported/taxonomy.inc
Implementation of hook_node_import_global().

File

supported/taxonomy.inc, line 288

Code

function _node_import_taxonomy_form2node($taxonomy) {
  $tids = array();
  foreach ($taxonomy as $key => $value) {
    if ($key != 'tags') {
      $value = is_array($value) ? $value : array(
        $value,
      );
      foreach ($value as $tid) {
        $tids[$tid] = taxonomy_get_term($tid);
      }
    }
    else {
      $tids[$key] = $value;
    }
  }
  return $tids;
}