You are here

function og_ui_menu in Organic groups 7

Same name and namespace in other branches
  1. 7.2 og_ui/og_ui.module \og_ui_menu()

Implements hook_menu().

File

og_ui/og_ui.module, line 11
Organic groups UI.

Code

function og_ui_menu() {
  $items = array();
  $items['group/%/%/subscribe'] = array(
    'type' => MENU_CALLBACK,
    'file' => 'og_ui.pages.inc',
    'page callback' => 'og_ui_subscribe',
    'page arguments' => array(
      1,
      2,
    ),
    // Function will take care of permissions, as we want to show "you are
    // already a member of the group" to group members, however it is not
    // possible to give authenticated group members the "subscribe" permissions.
    'access callback' => 'user_is_logged_in',
    // We don't add the group name, as it might be private.
    'title' => 'Join group',
  );
  $items['group/%/%/unsubscribe'] = array(
    'type' => MENU_CALLBACK,
    'file' => 'og_ui.pages.inc',
    'page callback' => 'og_ui_unsubscribe',
    'page arguments' => array(
      1,
      2,
    ),
    'access callback' => 'og_user_access_by_entity',
    'access arguments' => array(
      'unsubscribe',
      1,
      2,
    ),
    'title' => 'Leave group',
  );
  $items['group/%/%/admin/people/add-user'] = array(
    'page callback' => 'drupal_get_form',
    'title' => 'Add members',
    'page arguments' => array(
      'og_ui_add_users',
      1,
      2,
    ),
    'type' => MENU_LOCAL_TASK,
    'file' => 'og_ui.admin.inc',
    'weight' => 5,
    'access callback' => 'og_user_access_by_entity',
    'access arguments' => array(
      'add user',
      1,
      2,
    ),
  );

  // User listing pages.
  $items['group/%/%/admin/people'] = array(
    'title arguments' => array(
      'People in group @group',
      1,
      2,
    ),
    'title callback' => 'og_ui_menu_title_callback',
    'description' => 'Find and manage group members.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'og_ui_user_admin_account',
      1,
      2,
    ),
    'access callback' => 'og_user_access_by_entity',
    'access arguments' => array(
      'approve and deny subscription',
      1,
      2,
    ),
    'weight' => -4,
    'file' => 'og_ui.admin.inc',
  );

  // Permission administration pages.
  $items['group/%/%/admin/people/roles'] = array(
    'title arguments' => array(
      'Roles for group @group',
      1,
      2,
    ),
    'title callback' => 'og_ui_menu_title_callback',
    'description' => 'List, edit, or add user roles.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'og_ui_user_admin_new_role',
      1,
      2,
    ),
    'access callback' => 'og_user_access_by_entity',
    'access arguments' => array(
      'administer group',
      1,
      2,
    ),
    'file' => 'og_ui.admin.inc',
    'weight' => -9,
  );
  $items['group/%/%/admin/people/roles/edit'] = array(
    'title' => 'Edit role',
    'page arguments' => array(
      'og_ui_user_admin_roles',
      1,
      2,
    ),
    'access callback' => 'og_user_access_by_entity',
    'access arguments' => array(
      'administer group',
      1,
      2,
    ),
    'type' => MENU_CALLBACK,
  );
  $items['group/%/%/admin/people/permissions'] = array(
    'title arguments' => array(
      'Permissions for group @group',
      1,
      2,
    ),
    'title callback' => 'og_ui_menu_title_callback',
    'description' => 'Determine access to features by selecting permissions for roles.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'og_ui_user_admin_permissions',
      1,
      2,
    ),
    'access callback' => 'og_user_access_by_entity',
    'access arguments' => array(
      'administer group',
      1,
      2,
    ),
    'file' => 'og_ui.admin.inc',
    'weight' => -8,
  );
  foreach (entity_get_info() as $entity => $value) {
    if ($value['fieldable']) {
      $items["{$entity}/%/group"] = array(
        'title' => 'Group',
        'page callback' => 'og_ui_group_admin_overview',
        'page arguments' => array(
          $entity,
          1,
        ),
        'access callback' => 'og_user_access_by_entity',
        'access arguments' => array(
          'access administration pages',
          $entity,
          1,
        ),
        'type' => MENU_LOCAL_TASK,
        'file' => 'og_ui.admin.inc',
        'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
      );
    }
  }
  $items['admin/config/group'] = array(
    'title' => 'Organic groups',
    'description' => 'Administer the suite of Organic groups modules.',
    'position' => 'right',
    'weight' => -5,
    'page callback' => 'system_admin_menu_block_page',
    'access arguments' => array(
      'administer group',
    ),
    'file' => 'system.admin.inc',
    'file path' => drupal_get_path('module', 'system'),
  );
  $items['admin/config/group/settings'] = array(
    'title' => 'Organic groups settings',
    'description' => 'Administer the Organic groups settings.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'og_ui_user_admin_settings',
    ),
    'access arguments' => array(
      'administer group',
    ),
    'file' => 'og_ui.admin.inc',
  );
  $items['admin/config/group/permissions'] = array(
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'og_ui_user_admin_global_permissions',
    ),
    'title' => 'Organic groups global permissions',
    'access arguments' => array(
      'administer group',
    ),
    'description' => 'Configure Organic groups global permissions.',
    'file' => 'og_ui.admin.inc',
  );
  $items['admin/config/group/roles'] = array(
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'og_ui_user_admin_new_role',
    ),
    'title' => 'Organic groups global roles',
    'access arguments' => array(
      'administer group',
    ),
    'description' => 'Configure Organic groups global roles.',
    'file' => 'og_ui.admin.inc',
  );
  $items['admin/config/group/roles/edit'] = array(
    'title' => 'Edit role',
    'page arguments' => array(
      'og_ui_user_admin_global_roles',
      '',
      '',
      5,
    ),
    'access arguments' => array(
      'administer group',
    ),
    'type' => MENU_CALLBACK,
  );
  $items['admin/config/group/fields'] = array(
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'og_ui_field_settings',
    ),
    'title' => 'Organic groups field settings',
    'access arguments' => array(
      'administer group',
    ),
    'description' => 'Configure Organic groups fields in bundles.',
    'file' => 'og_ui.admin.inc',
    'type' => MENU_NORMAL_ITEM,
  );
  $items['admin/config/group/fields/%/%/%field_ui_menu/delete'] = array(
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'og_ui_field_delete_form',
      6,
    ),
    'load arguments' => array(
      4,
      5,
      5,
      '%map',
    ),
    'title' => 'Delete',
    'access arguments' => array(
      'administer group',
    ),
    'description' => 'Delete an Organic groups field from a bundle.',
    'file' => 'og_ui.admin.inc',
    'type' => MENU_LOCAL_TASK,
  );
  return $items;
}