You are here

function taxonomy_manager_export_term_tree in Taxonomy Manager 7

Generates term tree export that prefixes child term with dashes.

The same format can be used for importing terms (see Add button).

1 call to taxonomy_manager_export_term_tree()
taxonomy_manager_export_form_submit in ./taxonomy_manager.admin.inc
Submit handler for the export form.

File

./taxonomy_manager.admin.inc, line 2752

Code

function taxonomy_manager_export_term_tree($tree) {
  $output = "";
  foreach ($tree as $term) {

    // If a term already starts with dashes, we have to escape the name.
    if (substr($term->name, 0, 1) == '-') {
      $name = '"' . $term->name . '"';
    }
    else {
      $name = $term->name;
    }
    $output .= str_repeat('-', $term->depth) . $name . "\n";
  }
  return $output;
}