You are here

function og_vocab_block_view in OG Vocabulary 6

Same name and namespace in other branches
  1. 5 og_vocab.module \og_vocab_block_view()
1 call to og_vocab_block_view()
og_vocab_block in ./og_vocab.module
Implementation of hook_block().

File

./og_vocab.module, line 628
Give each group its own system controlled vocabularies.

Code

function og_vocab_block_view() {
  $group_node = og_get_group_context();
  if ($group_node && node_access('view', $group_node) && !empty($group_node->og_vocabularies)) {
    $output = '';
    foreach ((array) $group_node->og_vocabularies as $vid => $vocab) {
      $tree = taxonomy_get_tree($vid);

      // TODO. link to full page view. maybe views provides this?
      // only show first 20 terms. wary of huge vocabs. not ideal.
      $tree = array_slice($tree, 0, 20);
      $index = 0;
      $items = og_vocab_build_list_items($index, $tree);
      if ($items) {
        $output .= theme('item_list', $items, $vocab->name);
      }
    }
    $block['content'] = $output;
    $block['subject'] = t('Group categories');
    return $block;
  }
}