You are here

function tft_is_term_archived in Taxonomy File Tree 7.2

Same name and namespace in other branches
  1. 7 tft.module \tft_is_term_archived()
2 calls to tft_is_term_archived()
tft_is_file_archived in ./tft.module
tft_restore_archived_element in ./tft.module

File

./tft.module, line 1263
Hook implementations and module logic for TFT.

Code

function tft_is_term_archived($tid) {
  $og_nid = tft_get_og_nid($tid);
  $og_tid = tft_get_og_tid($og_nid);
  $archive_tid = tft_get_archive_tid($og_tid);
  $root_tid = $tid;
  $depth = tft_get_depth($tid);
  while ($depth > 1 && $root_tid) {
    $root_tid = db_query("SELECT parent FROM {taxonomy_term_hierarchy} WHERE tid = :tid", array(
      ':tid' => $tid,
    ))
      ->fetchField();
    $depth--;
  }
  return $root_tid == $archive_tid;
}