You are here

function og_subgroups_hs_hierarchical_select_item_get_label in Subgroups for Organic groups 6

Implementation of hook_hierarchical_select_item_get_label().

File

modules/og_subgroups_hs/og_subgroups_hs.module, line 184
Implementation of the Hierarchical Select API for the OG Subgroups module.

Code

function og_subgroups_hs_hierarchical_select_item_get_label($item, $params) {
  if ($item == OG_SUBGROUPS_HS_ANY_OPTION) {
    return '<' . t('Any') . '>';
  }
  static $labels = array();
  if (!isset($labels[$item])) {

    // Fetch the tree
    og_subgroups_include('tree');
    $tree = og_subgroups_get_tree();

    // Flatten the tree
    $groups = og_subgroups_flatten_tree($tree);

    // Get the label
    $labels[$item] = $groups[$item]->title;
  }
  return $labels[$item];
}