function og_subgroups_block in Subgroups for Organic groups 5
Same name and namespace in other branches
- 5.4 og_subgroups.module \og_subgroups_block()
 - 6 og_subgroups.module \og_subgroups_block()
 
Implementation of hook_block().
Displays the book table of contents in a block when the current page is a single-node view inside a group context.
File
- ./
og_subgroups.module, line 184  - Maintains subgroups hierarchy created by the orgainc groups module.
 
Code
function og_subgroups_block($op = 'list', $delta = 0) {
  $block = array();
  if ($op == 'list') {
    $block[0]['info'] = t('Subgroups');
    return $block;
  }
  else {
    if ($op == 'view') {
      // Only display this block when the user is browsing inside a group:
      $arg = arg(1);
      if ($group_node = og_get_group_context()) {
        $block['subject'] = t('Subgroups');
        $inaccessibale = og_subgroups_get_eligable_groups('inaccessibale');
        $block['content'] = og_subgroups_menu_tree($group_node->nid, $group_node->title, $inaccessibale);
      }
      return $block;
    }
  }
}