function _taxonomy_csv_values in Taxonomy CSV import/export 6.2
Same name and namespace in other branches
- 6.5 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.
10 calls to _taxonomy_csv_values()
- 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.
- taxonomy_csv_import in import/
taxonomy_csv.import.api.inc - Process the import of an input.
- _taxonomy_csv_export_check_options in export/
taxonomy_csv.export.admin.inc - Validate options of exported vocabulary.
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_DEFINITION_LINKS => t('Full term definition and links'),
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_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_DEFINITION_LINKS => t('Full term definition and links'),
// @todo, but useless: use alone_terms.
// 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_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,
'source_choice' => 'text',
'import_delimiter' => 'comma',
'import_delimiter_custom' => '',
'import_enclosure' => 'none',
'import_enclosure_custom' => '',
'check_line' => TRUE,
'check_utf8' => TRUE,
'locale_custom' => '',
'vocabulary_target' => 'autocreate',
'vocabulary_id' => 'choose_vocabulary',
'check_hierarchy' => FALSE,
'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,
'delimiter' => ',',
'enclosure' => '',
'check_line' => FALSE,
'check_utf8' => FALSE,
'locale_custom' => '',
'vocabulary_target' => 'autocreate',
'vocabulary_id' => 'choose_vocabulary',
'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_delimiter' => 'comma',
'export_delimiter_custom' => '',
'export_enclosure' => 'none',
'export_enclosure_custom' => '',
'export_line_ending' => 'Unix',
'export_order' => 'name',
'result_duplicates' => TRUE,
// Default options of specific imports.
'def_links_terms_ids' => 'name_if_needed',
'def_links_vocabularies_ids' => 'none',
);
case 'export_default_api':
return array(
'export_format' => TAXONOMY_CSV_FORMAT_ALONE_TERMS,
'vocabulary_id' => 0,
'delimiter' => ',',
'enclosure' => '"',
'line_ending' => 'Unix',
'order' => 'name',
'result_duplicates' => FALSE,
'check_options' => FALSE,
'result_display' => FALSE,
// Default options of specific imports.
'def_links_terms_ids' => 'name_if_needed',
'def_links_vocabularies_ids' => 'none',
);
case 'import_option':
return array(
TAXONOMY_CSV_EXISTING_UPDATE => t('Update existing term (avoid duplicate terms)'),
TAXONOMY_CSV_EXISTING_UPDATE_MERGE => t('Update (merge) existing term and items if exist else create'),
TAXONOMY_CSV_EXISTING_UPDATE_REPLACE => t('Update (replace) existing term and items if exist else create'),
TAXONOMY_CSV_EXISTING_IGNORE => t('Duplicate existing term'),
TAXONOMY_CSV_EXISTING_IGNORE_CREATE => t('Ignore existing term and create a new term'),
TAXONOMY_CSV_EXISTING_IGNORE_ALL => t('Ignore existing term and create a new term for each term on the line'),
TAXONOMY_CSV_EXISTING_IGNORE_QUICK => t('Ignore existing terms (quicker, but duplicates may be created)'),
);
case 'import_allowed':
$items = array(
TAXONOMY_CSV_FORMAT_ALONE_TERMS => array(
TAXONOMY_CSV_EXISTING_UPDATE,
TAXONOMY_CSV_EXISTING_IGNORE_QUICK,
),
TAXONOMY_CSV_FORMAT_DEFINITION_LINKS => array(
TAXONOMY_CSV_EXISTING_UPDATE_MERGE,
),
TAXONOMY_CSV_FORMAT_FLAT => array(
TAXONOMY_CSV_EXISTING_UPDATE,
TAXONOMY_CSV_EXISTING_IGNORE_QUICK,
),
TAXONOMY_CSV_FORMAT_TREE_STRUCTURE => array(
TAXONOMY_CSV_EXISTING_UPDATE_REPLACE,
TAXONOMY_CSV_EXISTING_IGNORE_CREATE,
TAXONOMY_CSV_EXISTING_IGNORE_QUICK,
),
TAXONOMY_CSV_FORMAT_POLYHIERARCHY => array(
TAXONOMY_CSV_EXISTING_UPDATE_MERGE,
),
TAXONOMY_CSV_FORMAT_PARENTS => array(
TAXONOMY_CSV_EXISTING_UPDATE_MERGE,
TAXONOMY_CSV_EXISTING_UPDATE_REPLACE,
TAXONOMY_CSV_EXISTING_IGNORE_CREATE,
),
TAXONOMY_CSV_FORMAT_CHILDREN => array(
TAXONOMY_CSV_EXISTING_UPDATE_MERGE,
TAXONOMY_CSV_EXISTING_UPDATE_REPLACE,
TAXONOMY_CSV_EXISTING_IGNORE_CREATE,
),
TAXONOMY_CSV_FORMAT_RELATIONS => array(
TAXONOMY_CSV_EXISTING_UPDATE_MERGE,
TAXONOMY_CSV_EXISTING_UPDATE_REPLACE,
TAXONOMY_CSV_EXISTING_IGNORE_CREATE,
),
TAXONOMY_CSV_FORMAT_SYNONYMS => array(
TAXONOMY_CSV_EXISTING_UPDATE_MERGE,
TAXONOMY_CSV_EXISTING_UPDATE_REPLACE,
TAXONOMY_CSV_EXISTING_IGNORE_QUICK,
),
TAXONOMY_CSV_FORMAT_DEFINITIONS => array(
TAXONOMY_CSV_EXISTING_UPDATE_MERGE,
TAXONOMY_CSV_EXISTING_UPDATE_REPLACE,
TAXONOMY_CSV_EXISTING_IGNORE_QUICK,
),
TAXONOMY_CSV_FORMAT_DESCRIPTIONS => array(
TAXONOMY_CSV_EXISTING_UPDATE_MERGE,
TAXONOMY_CSV_EXISTING_UPDATE_REPLACE,
TAXONOMY_CSV_EXISTING_IGNORE_QUICK,
),
TAXONOMY_CSV_FORMAT_WEIGHTS => array(
TAXONOMY_CSV_EXISTING_UPDATE_MERGE,
TAXONOMY_CSV_EXISTING_IGNORE_QUICK,
),
);
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;
}