function taxonomy_node_import_options in Node import 6
Implementation of hook_node_import_options().
File
- supported/
taxonomy.inc, line 542 - Support file for the core taxonomy module.
Code
function taxonomy_node_import_options($type, $options, $fields, $map) {
$form = array();
return $form;
//TODO: reenable this.
// Import taxonomy terms for nodes.
if (($node_type = node_import_type_is_node($type)) !== FALSE) {
// Copy from taxonomy_form_alter().
$c = db_query(db_rewrite_sql("SELECT v.* FROM {vocabulary} v INNER JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE n.type = '%s' ORDER BY v.weight, v.name", 'v', 'vid'), $node_type);
$create_options = array(
'create' => t('create it') . ',',
'remove' => t('remove it from the selection') . ',',
'error' => t('treat it as an import error') . '.',
);
if (user_access('administer taxonomy')) {
$create_default = 'create';
}
else {
unset($create_options['create']);
$create_default = 'error';
}
while ($vocabulary = db_fetch_object($c)) {
$field = 'taxonomy:' . $vocabulary->vid;
if (isset($map[$field]) && !empty($map[$field])) {
if (!$vocabulary->tags) {
$form[$field] = array(
'#title' => $vocabulary->name,
'non_existing_terms' => array(
'#title' => t('When a term does not exist'),
'#type' => 'radios',
'#options' => $create_options,
'#default_value' => isset($options[$field]['non_existing_terms']) ? $options[$field]['non_existing_terms'] : $create_default,
),
);
}
}
}
}
return $form;
}