You are here

function _termcase_update_all_terms in Termcase 7

Same name and namespace in other branches
  1. 6 termcase.module \_termcase_update_all_terms()

Apply case formatting to all terms in a vocabulary.

Helper function to loop through all terms in the specified vocabulary and apply the case formatting to each of them.

1 call to _termcase_update_all_terms()
termcase_taxonomy_vocabulary_update in ./termcase.module
Implements hook_taxonomy_vocabulary_update().

File

./termcase.module, line 234
The Termcase module gives you the option to specify specific case-formatting on terms.

Code

function _termcase_update_all_terms($vocabulary_name, $case) {
  $vocabulary = taxonomy_vocabulary_machine_name_load($vocabulary_name);
  $tree = taxonomy_get_tree($vocabulary->vid);
  foreach ($tree as $term) {
    $term->name = _termcase_convert_string_to_case($term->name, $case);
    _termcase_update_term_name($term);
  }
  drupal_set_message(t('@terms been updated', array(
    '@terms' => format_plural(sizeof($tree), '1 term has', '@count terms have'),
  )));
}