You are here

function userreference_node_import_fields in Node import 6

Implementation of hook_node_import_fields().

File

supported/cck/userreference.inc, line 11
Support file for the CCK User reference module.

Code

function userreference_node_import_fields($type) {
  $fields = array();
  foreach (node_import_cck_fields($type, 'userreference') as $fieldname => $fieldinfo) {
    foreach ($fieldinfo['columns'] as $colname => $colinfo) {
      $cck_fieldname = node_import_cck_name($fieldname, $colname);
      $fields[$cck_fieldname] = node_import_cck_field_defaults($fieldinfo);
      switch ($colname) {
        case 'uid':
          $fields[$cck_fieldname]['title'] = $fieldinfo['widget']['label'];
          $fields[$cck_fieldname]['input_format'] = 'user_reference';
          $fields[$cck_fieldname]['output_format'] = $fieldinfo['widget']['type'] == 'userreference_autocomplete' ? 'name' : 'uid';
          $fields[$cck_fieldname]['map_required'] = $fieldinfo['required'];
          break;
        default:
          $fields[$cck_fieldname]['title'] = t('Unsupported: ') . $fieldinfo['widget']['label'] . ' - ' . $colname;
          break;
      }
    }
  }
  return $fields;
}