You are here

function taxonomy_xml_import_form in Taxonomy import/export via XML 5.2

Same name and namespace in other branches
  1. 5 taxonomy_xml.module \taxonomy_xml_import_form()
  2. 6.2 taxonomy_xml.module \taxonomy_xml_import_form()
  3. 6 taxonomy_xml.module \taxonomy_xml_import_form()
  4. 7 taxonomy_xml.admin.inc \taxonomy_xml_import_form()

Builds the import form.

1 string reference to 'taxonomy_xml_import_form'
taxonomy_xml_import in ./taxonomy_xml.module
Menu callback for the import page.

File

./taxonomy_xml.module, line 215
taxonomy_xml.module This module makes it possible to import and export taxonomies as XML documents.

Code

function taxonomy_xml_import_form() {
  $formats = taxonomy_xml_formats();
  $vocs[0] = t('[Determined by source file]');
  foreach (module_invoke('taxonomy', 'get_vocabularies') as $vid => $voc) {
    $vocs[$vid] = $voc->name;
  }
  $vocs[-1] = t('[Create new]');
  $form['vid'] = array(
    '#type' => 'select',
    '#title' => t('Target vocabulary'),
    '#default_value' => 0,
    '#options' => $vocs,
    '#description' => t('The vocabulary into which terms should be loaded.'),
  );

  /*
    $form['term'] = array(
      '#type' => 'checkbox',
      '#title' => ('Select a term from the vocabulary.'),
      '#description' => t("Allows a selection of a term in the vocabulary to be the parent of the imported taxonomy."),
    );*/
  $form['xml'] = array(
    '#type' => 'file',
    '#title' => t('File to import'),
    '#description' => t('Click "Browse..." to select an XML document to upload.'),
  );
  $form['format'] = array(
    '#type' => 'select',
    '#title' => t('Format of file'),
    '#default_value' => 'xml_format',
    '#options' => $formats,
  );
  $form['duplicate'] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow duplicate terms'),
    '#description' => t('If you want to keep the same term in different positions in the vocabulary hierarchy, check this'),
    '#default_value' => 0,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Import'),
  );
  $form['#attributes'] = array(
    'enctype' => 'multipart/form-data',
  );
  return $form;
}