function _taxonomy_csv_values in Taxonomy CSV import/export 6.5
Same name and namespace in other branches
- 6.2 taxonomy_csv.api.inc \_taxonomy_csv_values()
- 6.3 taxonomy_csv.api.inc \_taxonomy_csv_values()
- 6.4 taxonomy_csv.api.inc \_taxonomy_csv_values()
- 7.5 taxonomy_csv.api.inc \_taxonomy_csv_values()
- 7.4 taxonomy_csv.api.inc \_taxonomy_csv_values()
Helper to remember some items and to describe features.
Parameters
$list: A string matching list to be returned:
- 'import_format' : internal and external available formats for import.
- 'export_format' : internal and external available formats for export.
- 'import_default_ui' : default options to import by user interface.
- 'import_default_api': default options to import by api.
- 'export_default_ui' : default options to export by user interface.
- 'export_default_api': default options to export by api.
- 'import_option' : descriptions of options for existing items.
- 'import_allowed' : allowed options for existing items when importing.
Lists are completed with external formats.
Return value
Array of wanted content.
12 calls to _taxonomy_csv_values()
- drush_taxonomy_csv_export in ./
taxonomy_csv.drush.inc - Process the export of a vocabulary.
- drush_taxonomy_csv_import in ./
taxonomy_csv.drush.inc - Process the import of an input.
- taxonomy_csv_export in export/
taxonomy_csv.export.api.inc - Process the export of a vocabulary.
- taxonomy_csv_form_export in export/
taxonomy_csv.export.admin.inc - Generates the taxonomy CSV export form.
- taxonomy_csv_form_import in import/
taxonomy_csv.import.admin.inc - Generates the taxonomy CSV import form.
File
- ./
taxonomy_csv.api.inc, line 79 - Manage variables and features of module.
Code
function _taxonomy_csv_values($list) {
switch ($list) {
case 'import_format':
$items = array(
TAXONOMY_CSV_FORMAT_ALONE_TERMS => t('Term names (ignore additional columns)'),
TAXONOMY_CSV_FORMAT_FLAT => t('Terms (flat vocabulary)'),
TAXONOMY_CSV_FORMAT_TREE_STRUCTURE => t('Hierarchical tree structure or one term by line structure'),
TAXONOMY_CSV_FORMAT_POLYHIERARCHY => t('Polyhierarchical structure'),
TAXONOMY_CSV_FORMAT_DEFINITION_LINKS => t('Full term definition and links'),
TAXONOMY_CSV_FORMAT_PARENTS => t('First level parents'),
TAXONOMY_CSV_FORMAT_CHILDREN => t('First level children'),
TAXONOMY_CSV_FORMAT_RELATIONS => t('Related terms'),
TAXONOMY_CSV_FORMAT_SYNONYMS => t('Synonyms terms'),
TAXONOMY_CSV_FORMAT_DEFINITIONS => t('Full term definitions'),
TAXONOMY_CSV_FORMAT_DESCRIPTIONS => t('Term descriptions'),
TAXONOMY_CSV_FORMAT_WEIGHTS => t('Term weights'),
);
break;
case 'export_format':
$items = array(
TAXONOMY_CSV_FORMAT_ALONE_TERMS => t('Term names'),
TAXONOMY_CSV_FORMAT_TID_NAME => t('Tid and name of terms'),
TAXONOMY_CSV_FORMAT_TREE_STRUCTURE => t('Hierarchical tree structure or one term by line structure'),
// TAXONOMY_CSV_FORMAT_POLYHIERARCHY => t('Polyhierarchical structure'),
TAXONOMY_CSV_FORMAT_DEFINITION_LINKS => t('Full term definition and links (compatible with Taxonomy CSV 6.x-5.x)'),
TAXONOMY_CSV_FORMAT_FIELDS => t('Full term definition and links (compatible with Taxonomy CSV 7.x-5.x)'),
TAXONOMY_CSV_FORMAT_PARENTS => t('First level parents'),
TAXONOMY_CSV_FORMAT_CHILDREN => t('First level children'),
TAXONOMY_CSV_FORMAT_RELATIONS => t('Related terms'),
TAXONOMY_CSV_FORMAT_SYNONYMS => t('Synonyms terms'),
TAXONOMY_CSV_FORMAT_DEFINITIONS => t('Full term definitions'),
TAXONOMY_CSV_FORMAT_DESCRIPTIONS => t('Term descriptions'),
TAXONOMY_CSV_FORMAT_WEIGHTS => t('Term weights'),
);
break;
case 'import_default_ui':
return array(
'import_format' => TAXONOMY_CSV_FORMAT_ALONE_TERMS,
'keep_order' => FALSE,
'source_choice' => 'text',
'import_delimiter' => 'comma',
'import_delimiter_soft_tab_width' => '2',
'import_delimiter_custom' => '',
'import_enclosure' => 'none',
'import_enclosure_custom' => '',
'check_line' => TRUE,
'check_utf8' => TRUE,
'locale_custom' => '',
'vocabulary_target' => 'autocreate',
'vocabulary_id' => 'choose_vocabulary',
'delete_terms' => FALSE,
'check_hierarchy' => TRUE,
'set_hierarchy' => 2,
// Polyhierarchy.
'existing_items' => TAXONOMY_CSV_EXISTING_UPDATE,
// Specific to relations import.
'relations_create_subrelations' => FALSE,
'relations_all_vocabularies' => FALSE,
// General options.
'result_stats' => 'result_stats',
'result_terms' => 'result_terms',
'result_level' => 'notices',
'result_type' => 'by_message',
);
case 'import_default_api':
return array(
'import_format' => TAXONOMY_CSV_FORMAT_ALONE_TERMS,
'keep_order' => FALSE,
'delimiter' => ',',
'enclosure' => '',
'check_line' => FALSE,
'check_utf8' => FALSE,
'locale_custom' => '',
'vocabulary_target' => 'autocreate',
'vocabulary_id' => 'choose_vocabulary',
'delete_terms' => FALSE,
'check_hierarchy' => TRUE,
'set_hierarchy' => 2,
// Polyhierarchy.
'existing_items' => TAXONOMY_CSV_EXISTING_UPDATE,
// Specific to relations import.
'relations_create_subrelations' => FALSE,
'relations_all_vocabularies' => FALSE,
// General options.
'check_options' => FALSE,
'result_display' => FALSE,
'result_stats' => FALSE,
'result_terms' => FALSE,
'result_level' => 'first',
'result_type' => 'by_message',
);
case 'export_default_ui':
return array(
'export_format' => TAXONOMY_CSV_FORMAT_ALONE_TERMS,
'export_vocabulary_id' => 0,
'export_delimiter' => 'comma',
'export_delimiter_custom' => '',
'export_enclosure' => 'quotation',
'export_enclosure_custom' => '',
'export_line_ending' => 'Unix',
// Default options of specific imports.
'def_links_terms_ids' => 'name_if_needed',
'def_links_vocabularies_ids' => 'none',
// General options.
'export_order' => 'name',
'result_duplicates' => TRUE,
);
case 'export_default_api':
return array(
'export_format' => TAXONOMY_CSV_FORMAT_ALONE_TERMS,
'vocabulary_id' => 0,
'delimiter' => ',',
'enclosure' => '"',
'line_ending' => 'Unix',
'order' => 'name',
// Default options of specific imports.
'def_links_terms_ids' => 'name_if_needed',
'def_links_vocabularies_ids' => 'none',
// General options.
'result_duplicates' => FALSE,
'check_options' => FALSE,
'result_display' => FALSE,
);
case 'import_option':
return array(
TAXONOMY_CSV_EXISTING_UPDATE => t('Update it (avoid duplicate terms)'),
TAXONOMY_CSV_EXISTING_UPDATE_REPLACE => t('Replace it (avoid duplicate terms)'),
TAXONOMY_CSV_EXISTING_IGNORE => t('Ignore it and create a new term (duplicate terms may be created)'),
TAXONOMY_CSV_EXISTING_IGNORE_ALL => t('Ignore it and create a new term for each term on the line (duplicate terms may be created)'),
);
case 'import_allowed':
$items = array(
TAXONOMY_CSV_FORMAT_ALONE_TERMS => array(
TAXONOMY_CSV_EXISTING_UPDATE,
TAXONOMY_CSV_EXISTING_IGNORE,
),
TAXONOMY_CSV_FORMAT_FLAT => array(
TAXONOMY_CSV_EXISTING_UPDATE,
TAXONOMY_CSV_EXISTING_IGNORE,
),
TAXONOMY_CSV_FORMAT_TREE_STRUCTURE => array(
TAXONOMY_CSV_EXISTING_UPDATE_REPLACE,
TAXONOMY_CSV_EXISTING_IGNORE,
),
TAXONOMY_CSV_FORMAT_POLYHIERARCHY => array(
TAXONOMY_CSV_EXISTING_UPDATE,
),
TAXONOMY_CSV_FORMAT_DEFINITION_LINKS => array(
TAXONOMY_CSV_EXISTING_UPDATE,
),
TAXONOMY_CSV_FORMAT_PARENTS => array(
TAXONOMY_CSV_EXISTING_UPDATE,
TAXONOMY_CSV_EXISTING_UPDATE_REPLACE,
TAXONOMY_CSV_EXISTING_IGNORE,
),
TAXONOMY_CSV_FORMAT_CHILDREN => array(
TAXONOMY_CSV_EXISTING_UPDATE,
TAXONOMY_CSV_EXISTING_UPDATE_REPLACE,
TAXONOMY_CSV_EXISTING_IGNORE,
),
TAXONOMY_CSV_FORMAT_RELATIONS => array(
TAXONOMY_CSV_EXISTING_UPDATE,
TAXONOMY_CSV_EXISTING_UPDATE_REPLACE,
TAXONOMY_CSV_EXISTING_IGNORE,
),
TAXONOMY_CSV_FORMAT_SYNONYMS => array(
TAXONOMY_CSV_EXISTING_UPDATE,
TAXONOMY_CSV_EXISTING_UPDATE_REPLACE,
TAXONOMY_CSV_EXISTING_IGNORE,
),
TAXONOMY_CSV_FORMAT_DEFINITIONS => array(
TAXONOMY_CSV_EXISTING_UPDATE,
TAXONOMY_CSV_EXISTING_UPDATE_REPLACE,
TAXONOMY_CSV_EXISTING_IGNORE,
),
TAXONOMY_CSV_FORMAT_DESCRIPTIONS => array(
TAXONOMY_CSV_EXISTING_UPDATE,
TAXONOMY_CSV_EXISTING_UPDATE_REPLACE,
TAXONOMY_CSV_EXISTING_IGNORE,
),
TAXONOMY_CSV_FORMAT_WEIGHTS => array(
TAXONOMY_CSV_EXISTING_UPDATE,
TAXONOMY_CSV_EXISTING_IGNORE,
),
);
break;
default:
return;
}
// Complete some lists with external formats.
$formats = taxonomy_csv_formats_get();
foreach ($formats as $format) {
if (isset($format[$list])) {
$items[$format['format']] = $format[$list];
}
}
return $items;
}