You are here

function location_taxonomize_empty_vocab in Location Taxonomize 7.2

Same name and namespace in other branches
  1. 7 location_taxonomize.inc \location_taxonomize_empty_vocab()

Empties the Location Vocabulary (called as an AJAX callback from the admin form)

1 call to location_taxonomize_empty_vocab()
_location_taxonomize_reset in ./location_taxonomize.inc
Resets the module, as if it was uninstalled and installed again and the vocab was emptied.
1 string reference to 'location_taxonomize_empty_vocab'
location_taxonomize_form in ./location_taxonomize.admin.inc
Location Taxonomize administration form

File

./location_taxonomize.inc, line 66
Some useful functions for Location taxonomize

Code

function location_taxonomize_empty_vocab() {
  $terms = taxonomy_get_tree(variable_get('location_taxonomize_vid'));
  foreach ($terms as $term) {
    taxonomy_term_delete($term->tid);
  }
  $termsnow = taxonomy_get_tree(variable_get('location_taxonomize_vid'));
  if (!$termsnow) {
    return t('Location vocabulary emptied.');
  }
  return t('There was a problem emptying the Location Vocabulary.');
}