You are here

function group_page in Group 7

Generates the front page of a group.

Parameters

Group $group: The group object.

Return value

array A render array suitable for use by drupal_render().

3 string references to 'group_page'
GroupUIController::hook_menu in classes/group.ui_controller.inc
Provides definitions for implementing hook_menu().
group_group_view_menu_alter in plugins/page_manager/tasks/group_view.inc
Tries to hi-jack the group/%group path.
group_group_view_page in plugins/page_manager/tasks/group_view.inc
Entry point for our overridden group view.

File

pages/group.inc, line 98
Page functions for groups.

Code

function group_page(Group $group) {

  // If there is a menu link to this group, the link becomes the last part
  // of the active trail, and the link name becomes the page title.
  // Thus, we must explicitly set the page title to be the group title.
  drupal_set_title($group
    ->label());

  // Retrieve the URI for the group.
  $uri = entity_uri('group', $group);

  // Set the group path as the canonical URL to prevent duplicate content.
  $attributes = array(
    'rel' => 'canonical',
    'href' => url($uri['path'], $uri['options']),
  );
  drupal_add_html_head_link($attributes, TRUE);

  // Set the non-aliased path as a default shortlink.
  $attributes = array(
    'rel' => 'shortlink',
    'href' => url($uri['path'], array_merge($uri['options'], array(
      'alias' => TRUE,
    ))),
  );
  drupal_add_html_head_link($attributes, TRUE);
  return $group
    ->view('full', NULL, TRUE);
}