You are here

function taxonomy_machine_name_enable in Taxonomy Machine Name 7

Implements hook_enable().

File

./taxonomy_machine_name.install, line 70
Taxonomy Machine Name Install File.

Code

function taxonomy_machine_name_enable() {
  $vocabularies = taxonomy_vocabulary_get_names();
  foreach ($vocabularies as $vocabulary) {
    $terms = taxonomy_term_load_multiple(array(), array(
      'vid' => $vocabulary->vid,
    ));
    foreach ($terms as $term) {
      if (empty($term->machine_name)) {
        taxonomy_term_save($term);
      }
    }
  }
}