You are here

function og_view_group in Organic groups 5.2

Same name and namespace in other branches
  1. 5.8 og.module \og_view_group()
  2. 5 og.module \og_view_group()
  3. 5.3 og.module \og_view_group()
  4. 5.7 og.module \og_view_group()
  5. 6.2 og.module \og_view_group()
  6. 6 og.module \og_view_group()
1 call to og_view_group()
og_nodeapi in ./og.module
Implementation of hook_nodeapi().

File

./og.module, line 1035

Code

function og_view_group(&$node, $teaser = FALSE, $page = FALSE) {
  if ($teaser || !$page) {
    $node->content['og_description'] = array(
      '#type' => 'item',
      '#title' => t('Description'),
      '#value' => $node->og_description,
    );
  }
  else {
    $bc[] = array(
      'path' => "og",
      'title' => t('Groups'),
    );
    $bc[] = array(
      'path' => "node/{$node->nid}",
      'title' => $node->title,
    );
    menu_set_location($bc);
    unset($node->content['body']);
    $node->content['og_mission'] = array(
      '#value' => theme('og_mission', $node),
      '#weight' => -3,
    );
    $view = views_get_view(variable_get('og_home_page_view', 'og_ghp_ron'));
    $views_available = variable_get('views_defaults', array());
    if ($views_available[$view->name] == "disabled") {

      // do nothing. assume the group node type handles homepage, or theme layer - i.e. node-<node_type>.tpl.php
    }
    else {
      $view->url = 'node';
      $args[] = $node->nid;

      // TODO: use own callback for feeds
      if (arg(2) == 'feed') {
        $view->description = $node->og_description;
        $args[] = 'feed';
      }
      $built = views_build_view('embed', $view, $args, $view->use_pager, $view->nodes_per_page);
      if ($GLOBALS['current_view']->num_rows || $view->page_empty) {
        $node->content['view'] = array(
          '#value' => $built,
        );
      }
      else {

        // use this default empty text unless overridden by View (which is a usually not a good idea. this text is smart)
        og_home_empty($node);
      }
    }
  }
}