You are here

function uif_get_taxonomy_value in User Import Framework 7

Helper function to process import data for core supported fields.

1 string reference to 'uif_get_taxonomy_value'
uif_uif_supported_fields in ./uif.admin.inc
Implementation of hook_uif_supported_fields().

File

./uif.admin.inc, line 1022
Simple, extensible user import from a CSV file.

Code

function uif_get_taxonomy_value($account, $field_info, $value) {
  if (uif_is_natural($value)) {
    return $value;
  }
  if (drupal_strlen($field_info['settings']['allowed_values'][0]['vocabulary'])) {
    $terms = taxonomy_get_term_by_name($value, $field_info['settings']['allowed_values'][0]['vocabulary']);
    if (count($terms)) {
      $tids = array_keys($terms);
      return $tids[0];
    }
  }
}