You are here

public function GroupUIController::hook_menu in Group 7

Provides definitions for implementing hook_menu().

Overrides EntityDefaultUIController::hook_menu

File

classes/group.ui_controller.inc, line 15
Defines the Entity API UI class for groups.

Class

GroupUIController
UI class for groups.

Code

public function hook_menu() {

  // Make this an entry in the Management menu.
  $items[$this->path] = array(
    'title' => 'Groups',
    'description' => 'Find and manage groups.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'group_overview_form',
      'group',
    ),
    'access arguments' => array(
      'access group overview',
    ),
    'file' => 'includes/entity.ui.inc',
    'weight' => -9,
  );

  // Make this an entry in the Management menu.
  $items["{$this->path}/overview"] = array(
    'title' => 'Groups',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
  );
  $items['group/autocomplete'] = array(
    'title' => 'Group autocomplete',
    'page callback' => 'group_autocomplete',
    // TRUE because of individual 'view' access checks on every group.
    'access callback' => TRUE,
    'file' => 'pages/group.inc',
    'file path' => drupal_get_path('module', 'group'),
    'type' => MENU_CALLBACK,
  );
  $items['group/autocomplete/type/%group_type'] = array(
    'title' => 'Group type specific autocomplete',
    'page callback' => 'group_autocomplete_by_type',
    'page arguments' => array(
      3,
    ),
    // TRUE because of individual 'view' access checks on every group.
    'access callback' => TRUE,
    'file' => 'pages/group.inc',
    'file path' => drupal_get_path('module', 'group'),
    'type' => MENU_CALLBACK,
  );
  $items['group/add'] = array(
    'title' => 'Add group',
    'page callback' => 'group_add_page',
    'access callback' => '_group_add_access',
    'file' => 'pages/group.inc',
    'file path' => drupal_get_path('module', 'group'),
  );
  foreach (group_types() as $name => $group_type) {
    $group = entity_create('group', array(
      'type' => $name,
    ));
    $items["group/add/{$name}"] = array(
      'title' => $group_type->label,
      'description' => "Create {$group_type->label}",
      'page callback' => 'entity_ui_get_form',
      'page arguments' => array(
        'group',
        $group,
        'add',
      ),
      'access callback' => 'entity_access',
      'access arguments' => array(
        'create',
        'group',
        $group,
      ),
      'file' => 'forms/group.inc',
      'file path' => drupal_get_path('module', 'group'),
    );
  }
  $items['group/%group'] = array(
    'title callback' => 'group_page_title',
    'title arguments' => array(
      1,
    ),
    'page callback' => 'group_page',
    'page arguments' => array(
      1,
    ),
    'access callback' => 'entity_access',
    'access arguments' => array(
      'view',
      'group',
      1,
    ),
    'file' => 'pages/group.inc',
    'file path' => drupal_get_path('module', 'group'),
  );
  $items['group/%group/view'] = array(
    'title' => 'View',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
  );
  $items['group/%group/edit'] = array(
    'title' => 'Edit',
    'page callback' => 'entity_ui_get_form',
    'page arguments' => array(
      'group',
      1,
    ),
    'access callback' => 'entity_access',
    'access arguments' => array(
      'update',
      'group',
      1,
    ),
    'file' => 'forms/group.inc',
    'file path' => drupal_get_path('module', 'group'),
    'type' => MENU_LOCAL_TASK,
    'weight' => -5,
  );
  $items['group/%group/delete'] = array(
    'title' => 'Delete',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'group_operation_form',
      'group',
      1,
      'delete',
    ),
    'access callback' => 'entity_access',
    'access arguments' => array(
      'delete',
      'group',
      1,
    ),
    'file' => 'forms/group.inc',
    'file path' => drupal_get_path('module', 'group'),
    'type' => MENU_CALLBACK,
  );
  return $items;
}