function taxonomy_csv_drush_command in Taxonomy CSV import/export 6.5
Same name and namespace in other branches
- 7.5 taxonomy_csv.drush.inc \taxonomy_csv_drush_command()
Implements hook_drush_command().
File
- ./
taxonomy_csv.drush.inc, line 11 - Drush commands for taxonomy CSV import/export.
Code
function taxonomy_csv_drush_command() {
$items = array();
$items['taxocsv-import'] = array(
'aliases' => array(
'vocimp',
),
'callback' => 'drush_taxonomy_csv_import',
'description' => 'Import taxonomies and hierarchical structures with CSV file.',
'examples' => array(
'drush taxocsv-import my_file alone_terms' => 'Import my_file using the default settings.',
'drush taxocsv-import my_file tree_structure --keep_order --delimiter=";" --check_line --vocabulary_target=existing --vocabulary_id=3 --existing_items=update_replace --result_terms' => 'Import my_file as a tree structure into vocabulary with vid 2, a semicolon for delimiter and default settings for other options, and display imported terms after process.',
),
'arguments' => array(
'file_path' => 'Required. The full path or url to CSV file to import',
'import_format' => "Optional. CSV format: 'alone_terms' (default), 'def_links', 'flat', 'tree_structure', 'polyhierarchy', 'parents', 'children', 'relations', 'synonyms', 'definitions', 'descriptions', 'weights' or 'fields'",
),
'options' => array(
'custom_format' => "List of comma separated fields (default: 'name') [>=D7 only]",
'keep_order' => 'Keep order of imported terms',
'delimiter' => 'CSV delimiter (default: ",")',
'enclosure' => "CSV enclosure (default: none or '\"')",
'check_line' => 'Check format of lines',
'check_utf8' => 'Check utf8 format',
'locale_custom' => 'Specific locale of imported file',
'vocabulary_target' => "'autocreate' (default), 'duplicate' or 'existing' (default if a vocabulary_id is set)",
'vocabulary_id' => 'vid or machine_name (>=D7 only) of the vocabulary to duplicate or to import into',
'custom_fields' => 'Custom comma separated fields to add or create [>=D7 only]',
'delete_terms' => 'Delete all terms before import',
'check_hierarchy' => 'Check vocabulary hierarchy',
'set_hierarchy' => "If hierarchy isn't checked, set it (0, 1 or 2 (default))",
'existing_items' => "What to do with existing items, which depends on import format:\n'update' (default), 'replace' or 'ignore'",
// Specific to relations import:
'relations_create_subrelations' => 'Create subrelations when importing relations',
'relations_all_vocabularies' => 'Allows relations with terms in other vocabularies',
// Level of result process infos.
'result_stats' => 'Display import stats',
'result_terms' => 'Display list of imported terms',
'result_level' => "Level of displayed messages: 'first' (default), 'warnings', 'notices' or 'infos'",
'result_type' => "Group infos 'by_message' (default) or 'by_line'",
),
);
$items['taxocsv-export'] = array(
'aliases' => array(
'vocexp',
),
'callback' => 'drush_taxonomy_csv_export',
'description' => 'Export terms and properties to a CSV file.',
'examples' => array(
'drush taxocsv-export 2 def_links' => "Export vocabulary with vid 2 with 'Full definition and links' format, using the default settings.",
'drush taxocsv-export 2 tree_structure --delimiter=";" --order=name' => 'Export vocabulary with vid 2 as a CSV tree_structure ordered by name, with a semicolon for delimiter, and default settings for other options.',
),
'arguments' => array(
'vocabulary_id' => 'Required. vid or machine_name (>=D7 only) of the vocabulary to export (0 means all)',
'export_format' => "Optional. CSV format: 'alone_terms' (default), 'tid_name', 'tree_structure', 'def_links', 'fields', 'parents', 'children', 'relations', 'synonyms', 'definitions', 'descriptions' or 'weights'",
'file_path' => "Optional. Full path or filename of exported csv file (default: [current directory]/taxocsv.csv)",
),
'options' => array(
'custom_format' => "List of comma separated fields (default: 'name') [>=D7 only]",
'delimiter' => 'One character csv delimiter (default: ",")',
'enclosure' => "Zero or one character csv enclosure (default: '\"')",
'line_ending' => "'Unix' (default), 'Mac' or 'MS-DOS'",
'order' => "Order of terms: 'name' (default), 'tid' or 'weight'",
// Specific to def_links:
'def_links_terms_ids' => "'name_if_needed' (default), 'name' or 'tid'",
'def_links_vocabularies_ids' => "'none' (default), 'name' or 'vid'",
// Level of result process infos.
'result_duplicates' => "Display duplicate terms",
),
);
return $items;
}