You are here

function classified_term_load in Classified Ads 7.3

Same name and namespace in other branches
  1. 6.3 classified.module \classified_term_load()

Menu loader for %classified_term.

Static cache implemented because loader appears to be often invoked twice: at loading, and during page preprocess, for theme('help').

Parameters

int $tid: The id for a term expected to be a Classified Ads category.

Return value

object A fully loaded term object if the tid is for a valid ads category.

File

./classified.module, line 1585
A pure D7 classified ads module inspired by the ed_classified module.

Code

function classified_term_load($tid) {
  static $terms = array();
  if (!isset($terms[$tid])) {
    $term = taxonomy_term_load($tid);
    $vid = _classified_get('vid');
    $terms[$tid] = isset($term->vid) && $term->vid == $vid ? $term : FALSE;
  }
  $ret = $terms[$tid];
  return $ret;
}