You are here

function og_vocab_block_view in OG Vocabulary 5

Same name and namespace in other branches
  1. 6 og_vocab.module \og_vocab_block_view()
1 call to og_vocab_block_view()
og_vocab_block in ./og_vocab.module

File

./og_vocab.module, line 139
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)) {
    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);
      $items = og_vocab_build_list_items($index = 0, $tree);
      if ($items) {
        $output .= theme('item_list', $items, $vocab->name);
      }
    }
    $block['content'] = $output;
    $block['subject'] = t('Group categories');
    return $block;
  }
}