You are here

function tft_is_term_archived in Taxonomy File Tree 7

Same name and namespace in other branches
  1. 7.2 tft.module \tft_is_term_archived()

Checks if the term is already archived.

Parameters

int $tid:

Return value

bool

2 calls to tft_is_term_archived()
tft_is_file_archived in ./tft.module
Checks if the file is already archived.
tft_restore_archived_element in ./tft.module

File

./tft.module, line 663
Module hooks.

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;
}