You are here

function termcase_taxonomy in Termcase 6

Implementation of hook_taxonomy().

File

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

Code

function termcase_taxonomy($op, $type, $edit = NULL) {
  $edit = (array) $edit;
  switch ("{$type}/{$op}") {
    case 'term/insert':
    case 'term/update':
      _termcase_update_term_name($edit['tid'], _termcase_convert_string_to_case($edit['name'], _termcase_vocabulary_termcase($edit['vid'])));
      if (_termcase_vocabulary_termcase_synonyms($edit['vid']['#value'])) {
        _termcase_update_term_synonyms($tid, _termcase_vocabulary_termcase($edit['vid']));
      }
      break;
    case 'vocabulary/insert':
    case 'vocabulary/update':

      // Update vocabulary settings.
      if (isset($edit['termcase_options'])) {
        _termcase_vocabulary_termcase($edit['vid'], $edit['termcase_options']);
        _termcase_vocabulary_termcase_synonyms($edit['vid'], $edit['termcase_affect_synonyms']);
        _termcase_vocabulary_termcase_display_notice($edit['vid'], $edit['termcase_display_notice']);
        if ($edit['termcase_update_terms'] != 0 && $op == 'update') {
          _termcase_update_all_terms($edit['vid']);
        }
      }
      break;
  }
}