$value) { $list_previous_values[$key] = isset($form_state['values'][$key]) ? $form_state['values'][$key] : variable_get('taxonomy_csv_' . $key, $value); } $list_import_format = _taxonomy_csv_values('import_format'); $list_import_delimiter = array( 'comma' => t('« , » (Comma)'), 'semicolon' => t('« ; » (Semicolon)'), 'tabulation' => t('« » (Tabulation)'), 'pipe' => t('« | » (Pipe)'), 'space' => t('« » (Space)'), 'currency_sign' => t('« ¤ » (Currency sign)'), 'soft_tab' => t('« » (Soft tab: two spaces or more)'), 'custom_delimiter' => t('Custom delimiter'), ); $list_import_enclosure = array( 'none' => t('None'), 'quotation' => t('« " » (Quotation mark)'), 'quote' => t("« ' » (Quote)"), 'custom_enclosure' => t('Custom enclosure'), ); $list_filter_format_custom = array( 'none' => t("None (Fixed plain text: user can't choose)"), ); foreach (filter_formats($user) as $format) { $list_filter_format_custom[$format->format] = $format->name; } $list_filter_format = $list_filter_format_custom; unset($list_filter_format['none']); $list_import_language = array( 'und' => t('Language neutral'), ); if (module_exists('locale')) { $list_import_language += locale_language_list('name'); foreach (locale_language_list('native') as $key => $value) { $list_import_language[$key] .= ' [' . $value . ']'; } } $list_vocabularies = taxonomy_vocabulary_get_names(); $list_vocabulary_target = array( 'autocreate' => t('Autocreate a new vocabulary'), 'existing' => t('Import in an existing vocabulary'), ); // Build form. $form['tab'] = array( '#type' => 'vertical_tabs', '#default_tab' => 'format', ); $form['tab']['format'] = array( '#type' => 'fieldset', '#title' => t('1. What do you want to import?'), '#collapsible' => TRUE, '#collapsed' => FALSE, '#description' => t('Choose the type of import. Help for each type is displayed below when format is selected.') . '
' . '' . t('Important') . ': ' . t('If you have a tree structure, you should import it before fields or translations, and for each translation if you use a full Translate mode.'), ); $form['tab']['format']['import_format'] = array( '#type' => 'radios', '#title' => '', '#options' => $list_import_format, '#default_value' => $list_previous_values['import_format'], ); // Generic form for import format help. foreach ($list_import_format as $key => $value) { $form['tab']['format'][$key] = array( '#type' => 'item', '#states' => array( 'visible' => array( ':input[name=import_format]' => array('value' => $key), ), ), ); } // Prepare descriptions. $line_format = '

' . '' . t('Line format') . '
' . ''; $example = '

' . '' . t('Examples') . '' . ''; // Complete generic form with specific help for each import format. $form['tab']['format'][TAXONOMY_CSV_FORMAT_STRUCTURE]['#description'] = t('Allow to create a flat vocabulary, a tree structure (geography, classification...) or a polyhierarchy (genealogy, complex nomenclatures...).') . $line_format . t('term name, child term name, sub-child term name...') // Example Flat. . '

' . '' . t('Examples (flat)') . '' . '' // Example Tree. . '
' . '' . t('Examples (simple tree)') . '' . '' // Example Polyhierarchy. . '
' . '' . t('Examples (Polyhierarchy)') . '' . '