You are here

function group_add_page in Group 7

Displays add group links for available group types.

Redirects to group/add/[type] if only one group type is available.

1 string reference to 'group_add_page'
GroupUIController::hook_menu in classes/group.ui_controller.inc
Provides definitions for implementing hook_menu().

File

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

Code

function group_add_page() {
  $item = menu_get_item();
  $content = system_admin_menu_block($item);
  if (count($content) == 1) {
    $item = array_shift($content);
    drupal_goto($item['href']);
  }
  if ($content) {
    $output = theme('admin_block_content', array(
      'content' => $content,
    ));
  }
  else {
    $message = 'There are no group types available to you. Go to the <a href="@create-group">group type creation page</a> to add one or check the <a href="@group-permissions">Group module permissions</a>.';
    $replace = array(
      '@create-group' => url('admin/group/type/add'),
      '@group-permissions' => url('admin/people/permissions', array(
        'fragment' => 'module-group',
      )),
    );
    $output = '<p>' . t($message, $replace) . '</p>';
  }
  return $output;
}