You are here

function _hs_taxonomy_hierarchical_select_get_depth in Hierarchical Select 7.3

Same name and namespace in other branches
  1. 5.3 modules/hs_taxonomy.module \_hs_taxonomy_hierarchical_select_get_depth()
  2. 6.3 modules/hs_taxonomy.module \_hs_taxonomy_hierarchical_select_get_depth()

Get the depth of a vocabulary's tree.

Parameters

$vid: A vocabulary id.

Return value

The depth of the vocabulary's tree.

1 call to _hs_taxonomy_hierarchical_select_get_depth()
hs_taxonomy_form_field_ui_widget_type_form_alter in modules/hs_taxonomy.module
Implements hook_form_FORMID_alter().

File

modules/hs_taxonomy.module, line 1280
Implementation of the Hierarchical Select API for the Taxonomy module.

Code

function _hs_taxonomy_hierarchical_select_get_depth($vid) {
  $depth = -99999;
  $tree = _hs_taxonomy_hierarchical_select_get_tree($vid);
  foreach ($tree as $term) {
    if ($term->depth > $depth) {
      $depth = $term->depth;
    }
  }
  return $depth;
}