function uif_get_field_info in User Import Framework 7
Read and store field info relevant to the import.
1 call to uif_get_field_info()
- uif_validate_user_file in ./
uif.admin.inc - Read the user import file and validate on the way.
File
- ./
uif.admin.inc, line 807 - Simple, extensible user import from a CSV file.
Code
function uif_get_field_info($header) {
$field_info = array();
$users_table = drupal_get_schema('users');
$instance_fields = uif_field_info_instances('user', 'user');
$supported_fields = uif_get_supported_fields();
foreach ($header as $label) {
if (isset($users_table['fields'][$label])) {
$supported = isset($supported_fields[$label]);
$field_info[$label] = array(
'type' => 'core',
'supported' => $supported,
'data' => $users_table['fields'][$label],
);
if ($supported) {
$field_info[$label]['import'] = $supported_fields[$label];
}
}
elseif (isset($instance_fields[$label])) {
$data = uif_field_info_field($label);
$supported = isset($supported_fields[$data['type']]);
$field_info[$label] = array(
'type' => 'entity',
'supported' => $supported,
'data' => $data,
);
if ($supported) {
$field_info[$label]['import'] = $supported_fields[$data['type']];
}
}
else {
// Contrib module handling?
$supported = isset($supported_fields[$label]);
if (!$supported) {
$field_info[$label] = array(
'type' => 'unknown',
'supported' => FALSE,
);
}
}
if (!$supported) {
drupal_set_message(t('Unknown column @field in the import file. Data in this column will be ignored.', array(
'@field' => $label,
)), 'warning');
}
}
return $field_info;
}