function taxonomy_manager_check_language in Taxonomy Manager 7
Same name and namespace in other branches
- 6.2 taxonomy_manager.admin.inc \taxonomy_manager_check_language()
 
checks if terms in move or merge operation are of the same language
returns TRUE if operation allowed, else FALSE (different languages)
3 calls to taxonomy_manager_check_language()
- taxonomy_manager_double_tree_move_validate in ./
taxonomy_manager.admin.inc  - taxonomy_manager_form_move_validate in ./
taxonomy_manager.admin.inc  - Validation handler for moving terms
 - taxonomy_manager_term_data_form_validate_parents_add in ./
taxonomy_manager.admin.inc  
File
- ./
taxonomy_manager.admin.inc, line 1569  
Code
function taxonomy_manager_check_language($vid, $selected_tids, $parents) {
  if (module_exists('i18_ntaxonomy')) {
    if (count($parents) && count($selected_tids)) {
      $term = array_pop($parents);
      $lang = $term->language;
      if (i18n_taxonomy_vocabulary_mode($voc->vid, I18N_MODE_TRANSLATE)) {
        foreach ($parents as $parent) {
          if (_taxonomy_manager_term_get_lang($parent['tid']) != $lang) {
            return FALSE;
          }
        }
        foreach ($selected_tids as $tid) {
          if (_taxonomy_manager_term_get_lang($tid) != $lang) {
            return FALSE;
          }
        }
      }
    }
  }
  return TRUE;
}