You are here

function _sf_node_export_cck_content_taxonomy in Salesforce Suite 6.2

File

sf_contrib/sf_contrib.module, line 389
Provides integration with Location and CCK.

Code

function _sf_node_export_cck_content_taxonomy($source, $fieldname, $drupal_field_definition, $sf_field_definition) {
  if (empty($source->{$fieldname})) {
    return;
  }
  $data = $source->{$fieldname};
  $terms = NULL;
  if (!empty($data) && is_array($data)) {
    foreach ($data as $value) {
      $tid = $value['value'];
      $term = taxonomy_get_term($tid);
      if (!empty($term->name)) {
        if (!empty($terms)) {
          $terms .= ';';
        }
        $terms .= $term->name;
      }
    }
  }
  return $terms;
}