function content_node_import_global in Node import 5
Implementation of hook_node_import_global().
File
- supported/
cck/ content.inc, line 258
Code
function content_node_import_global($type, $global_values) {
$form = array();
$form['content_import_node']['fields'] = array(
'#type' => 'fieldset',
'#title' => t('Field options'),
'#description' => t('Select the default values you want to assign to all imported fields unless specifically set otherwise in the CSV file'),
'#tree' => TRUE,
);
$types = (array) content_types();
if (isset($types[$type])) {
$content_type = $types[$type];
foreach ($content_type['fields'] as $field) {
// Create a default value for each field column by creating a dummy name for each column.
$db_info = content_database_info($field);
foreach ($db_info['columns'] as $column => $info) {
$value = !empty($field['widget']['default_value'][0]['value']) ? $field['widget']['default_value'][0]['value'] : '';
$form['content_import_node']['fields'][$field['field_name'] . '_' . $column] = array(
'#type' => 'textfield',
'#title' => $field['widget']['label'] . ' ' . $column,
'#default_value' => $value,
);
}
}
}
return $form;
}