You are here

function taxonomy_manager_check_language in Taxonomy Manager 6.2

Same name and namespace in other branches
  1. 7 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)

4 calls to taxonomy_manager_check_language()
taxonomy_manager_double_tree_edit_move in ./taxonomy_manager.admin.inc
taxonomy_manager_form_merge_validate in ./taxonomy_manager.admin.inc
Validation handler for validating terms
taxonomy_manager_form_move_validate in ./taxonomy_manager.admin.inc
Validation handler for moving terms
taxonomy_manager_term_data_edit in ./taxonomy_manager.admin.inc
callback handler for updating term data

File

./taxonomy_manager.admin.inc, line 1358
Taxonomy Manager Admin

Code

function taxonomy_manager_check_language($vid, $selected_tids, $parents) {
  if (module_exists('i18ntaxonomy')) {
    if (count($parents) && count($selected_tids)) {
      $term = array_pop($parents);
      $lang = _taxonomy_manager_term_get_lang($term['tid']);
      if (i18ntaxonomy_vocabulary($vid) == I18N_TAXONOMY_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;
}