nodeterms_data

custom/nodeterms/nodeterms.module, line 201

Versions
6
nodeterms_data($vid)

Fetch nodeterms data for a vocabulary or defaults if there are no registered data.

▾ 2 functions call nodeterms_data()

nodeterms_form_taxonomy_form_vocabulary_alter in custom/nodeterms/nodeterms.module
Implementation of hook_form_alter().
nodeterms_vocabularies_output in custom/nodeterms/nodeterms.module
Output a node's vocabularies group by vocabulary with a customized display and terms formatting.

Code

<?php
function nodeterms_data($vid) {
  static $nodeterms_data;

  if (empty($nodeterms_data)) {
    $result = db_query('SELECT vid, teaser_vocabulary_display, teaser_terms_display, page_vocabulary_display, page_terms_display FROM {nodeterms}');
    while ($vocabulary = db_fetch_array($result)) {
      $nodeterms_data[$vocabulary['vid']] = $vocabulary;
    }
  }
  if (isset($nodeterms_data[$vid])) {
    return $nodeterms_data[$vid];
  }
  else {
    return array(
      'teaser_vocabulary_display' => NODETERMS_VOCABULARY_DISPLAY_DEFAULT,
      'teaser_terms_display' => NODETERMS_TERMS_DISPLAY_DEFAULT,
      'page_vocabulary_display' => NODETERMS_VOCABULARY_DISPLAY_DEFAULT, 
      'page_terms_display' => NODETERMS_TERMS_DISPLAY_DEFAULT,
    );
  }
}
?>