You are here

function _ed_tid_is_classified_term in Classified Ads 6.2

Same name and namespace in other branches
  1. 5.2 ed_classified_utils.inc \_ed_tid_is_classified_term()
  2. 5 ed_classified_utils.inc \_ed_tid_is_classified_term()
  3. 7.2 ed_classified_utils.inc \_ed_tid_is_classified_term()

Is a tid a 'classified' term? Is a tid a child of our taxonomy?

Parameters

$tid The term id to check.:

Return value

true if the term is a child of our vocabulary.

1 call to _ed_tid_is_classified_term()
ed_classified_link_alter in ./ed_classified.module
Implements hook_link_alter (&$links, $node).

File

./ed_classified_utils.inc, line 106
Simple text-based classified ads module.

Code

function _ed_tid_is_classified_term($tid) {
  $vid = _ed_classified_get_vid();
  $vocab = taxonomy_vocabulary_load($vid);
  $term = taxonomy_get_term($tid);
  if ($vocab->hierarchy && $vocab->module == EDI_CLASSIFIED_MODULE_NAME) {
    return $term->vid == $vid;
  }
  else {

    //
    // TODO: warn user about problems in a non-log-filling way.
    // _edi_wd(t('Internal error: Vocabulary !vid (@vocab_name) is not our dedicated classified ads vocabulary - someone has tampered with the vocabulary, or our stored variables.', array('!vid' => $vid, '@vocab_name' => $vocab->name)), WATCHDOG_ERROR);
    return FALSE;

    // sanity check: not possible since the vocab is not hierarchical or is not our vocabulary
  }
}