You are here

function _ed_tid_is_classified_term in Classified Ads 5

Same name and namespace in other branches
  1. 5.2 ed_classified_utils.inc \_ed_tid_is_classified_term()
  2. 6.2 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
Implementation of hook_link_alter (&$links, $node) Find and destroy old taxonomy links for the classified ads node. This will create links to the custom classified ads taxonomy view. This would be easier if the hook callback knew what module…

File

./ed_classified_utils.inc, line 104
Simple text-based classified ads module. Michael Curry, Exodus Development, Inc. exodusdev@gmail.com for more information, please visit http://exodusdev.com/drupal/modules/classified.module Copyright (c) 2006, 2007 Exodus Development, Inc. All Rights…

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