You are here

function date_import_taxonomy_form2node in Date 5

Same name and namespace in other branches
  1. 5.2 date_copy/date_copy.module \date_import_taxonomy_form2node()
  2. 6 date_copy/date_copy.module \date_import_taxonomy_form2node()

Convert the taxonomy array from the form form to the node form. Borrowed from the Node Import module.

1 call to date_import_taxonomy_form2node()
date_copy_type_misc_form in ./date_copy.module
A form to select miscellaneous other options for a content type.

File

./date_copy.module, line 231

Code

function date_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;
}