You are here

function taxonomy_manager_export_form_submit in Taxonomy Manager 7

Submit handler for the export form.

1 string reference to 'taxonomy_manager_export_form_submit'
taxonomy_manager_export_form in ./taxonomy_manager.admin.inc
form for exporting terms

File

./taxonomy_manager.admin.inc, line 2699

Code

function taxonomy_manager_export_form_submit($form, &$form_state) {
  $voc = $form_state['values']['voc'];
  $selected_tids = $selected_tids = $form_state['values']['taxonomy']['manager']['tree']['selected_terms'];
  $selected_tid = count($selected_tids) ? array_pop($selected_tids) : 0;
  $options = $form_state['values']['export'];
  $options['depth'] = !empty($options['depth']) ? $options['depth'] : NULL;
  $tree = taxonomy_manager_export_get_tree($voc->vid, $selected_tid, $options['depth'], $options['scope']);
  $data = '';
  if ($options['format'] == 'csv') {
    $data = taxonomy_manager_export_csv($tree, $options['csv']['delimiter']);
  }
  elseif ($options['format'] == 'term_tree') {
    $data = taxonomy_manager_export_term_tree($tree);
  }
  $form_state['values']['export']['data'] = $data;
  $form_state['rebuild'] = TRUE;
}