You are here

function facetapi_vocabulary_hierarchical in Facet API 6

Tests whether a vocabulary is hierarchical.

Parameters

$vid: An integer containing the vocabulary ID.

Return value

A boolean flagging whether the vocabulary is hierarchical.

1 call to facetapi_vocabulary_hierarchical()
facetapi_facetapi_facet_info in ./facetapi.module
Implementation of hook_facetapi_facet_info().

File

./facetapi.module, line 1026
An abstracted facet API that can be used by various search backens.

Code

function facetapi_vocabulary_hierarchical($vid) {
  $hierarchical = FALSE;
  if (module_exists('taxonomy')) {
    $vocabularies = taxonomy_get_vocabularies();
    if (isset($vocabularies[$vid])) {

      // @todo Make this a setting in the facet's configuration page.
      // $force_flat = variable_get('apachesolr_search_force_flat_vocabularies', array());
      if ($vocabularies[$vid]->hierarchy != 2 && $vocabularies[$vid]->tags != 1) {
        return TRUE;
      }
    }
  }
  return FALSE;
}