You are here

function _lexicon_get_related_terms in Lexicon 7

Find all term objects related to a given term ID.

Parameters

object $term: the term for which to get related items

Return value

array an array related-tid => related-term

1 call to _lexicon_get_related_terms()
_lexicon_term_add_info in ./lexicon.module
Lexicon function to add extra information to a term object.

File

./lexicon.module, line 1255
The Lexicon module is used to create lists of terms and definitions to use on a website and optionally mark those terms in the content of the website.

Code

function _lexicon_get_related_terms(&$term) {
  $related = array();
  $related_term_field = variable_get('lexicon_related_terms_field_' . $term->vid, '');
  if ($related_term_field != '') {
    $related_term_field_items = field_get_items('taxonomy_term', $term, $related_term_field);
    if (!empty($related_term_field_items)) {
      foreach ($related_term_field_items as $item) {
        $rel_term = taxonomy_term_load($item['tid']);
        if ($rel_term != FALSE) {
          $related[$item['tid']] = $rel_term;
        }
      }
    }
  }
  return $related;
}