You are here

function invite_menu in Invite 7.4

Same name and namespace in other branches
  1. 5.2 invite.module \invite_menu()
  2. 5 invite.module \invite_menu()
  3. 6.2 invite.module \invite_menu()
  4. 7.2 invite.module \invite_menu()

Implements hook_menu().

File

./invite.module, line 139

Code

function invite_menu() {
  $items = array();
  $items['invite/add'] = array(
    'title' => 'Add Invite',
    'page callback' => 'invite_admin_add_page',
    'access arguments' => array(
      'create any invite entities',
    ),
    'file' => 'includes/invite.admin.inc',
    'type' => MENU_LOCAL_ACTION,
    'tab_parent' => 'invite',
    'tab_root' => 'invite',
  );
  $invite_uri = 'invite/%invite';
  $invite_uri_argument_position = 1;
  $items[$invite_uri] = array(
    'title callback' => 'entity_label',
    'title arguments' => array(
      'invite',
      $invite_uri_argument_position,
    ),
    'page callback' => 'invite_view',
    'page arguments' => array(
      $invite_uri_argument_position,
    ),
    'access callback' => 'entity_access',
    'access arguments' => array(
      'view',
      'invite',
      $invite_uri_argument_position,
    ),
    'file' => 'includes/invite.pages.inc',
  );
  $items[$invite_uri . '/view'] = array(
    'title' => 'View',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
  );
  $items[$invite_uri . '/delete'] = array(
    'title' => 'Delete invite',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'invite_delete_form',
      $invite_uri_argument_position,
    ),
    'access callback' => 'entity_access',
    'access arguments' => array(
      'edit',
      'invite',
      $invite_uri_argument_position,
    ),
    'file' => 'includes/invite.admin.inc',
  );
  $items[$invite_uri . '/edit'] = array(
    'title' => 'Edit',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'invite_form',
      $invite_uri_argument_position,
    ),
    'access callback' => 'entity_access',
    'access arguments' => array(
      'edit',
      'invite',
      $invite_uri_argument_position,
    ),
    'file' => 'includes/invite.admin.inc',
    'type' => MENU_LOCAL_TASK,
    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
  );
  foreach (invite_get_types() as $type => $info) {
    $items['invite/add/' . $type] = array(
      'title' => 'Add invite',
      'page callback' => 'invite_add',
      'page arguments' => array(
        2,
      ),
      'access callback' => 'invite_access',
      'access arguments' => array(
        'create',
        $type,
      ),
      'file' => 'includes/invite.admin.inc',
    );
  }

  // Admin menu items.
  $items['admin/config/people/invite'] = array(
    'title' => 'Invite',
    'description' => 'Modify invitation settings.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'invite_settings_form',
    ),
    'access arguments' => array(
      'administer invitations',
    ),
    'type' => MENU_NORMAL_ITEM,
    'weight' => 10,
    'file' => 'includes/invite.admin.inc',
  );
  $items['admin/config/people/invite/common'] = array(
    'title' => 'Invite',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => 10,
  );

  // Frontend menu items.
  $weight = 20;
  foreach (invite_get_types() as $type => $info) {
    $items['user/%/invites/' . $type] = array(
      'title' => $info->label,
      'page callback' => 'invite_add',
      'page arguments' => array(
        3,
      ),
      'access callback' => 'invite_access',
      'access arguments' => array(
        'create',
        $type,
      ),
      'file' => 'includes/invite.admin.inc',
      'type' => MENU_LOCAL_TASK,
      'weight' => $weight++,
    );
  }
  $items['invite/accept/%invite_by_code'] = array(
    'page callback' => 'invite_accept',
    'page arguments' => array(
      2,
    ),
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
    'file' => 'includes/invite.pages.inc',
  );
  $items['invite/withdraw/%invite_by_code'] = array(
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'invite_withdraw_form',
      2,
    ),
    'access callback' => 'invite_withdraw_access',
    'access arguments' => array(
      2,
    ),
    'type' => MENU_CALLBACK,
    'file' => 'includes/invite.pages.inc',
  );
  $items['invite/resend/%invite_by_code'] = array(
    'title' => 'Resend invitation',
    'page callback' => 'invite_resend',
    'page arguments' => array(
      2,
    ),
    'access callback' => 'invite_resend_access',
    'access arguments' => array(
      2,
    ),
    'type' => MENU_CALLBACK,
    'file' => 'includes/invite.pages.inc',
  );
  if (variable_get('invite_version_updated', TRUE)) {
    $items['admin/config/people/invite/migrate'] = array(
      'title' => 'Migrate',
      'description' => 'Migrate version 2.x invites.',
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'invite_migrate_form',
      ),
      'access arguments' => array(
        'administer invitations',
      ),
      'type' => MENU_LOCAL_TASK,
      'weight' => 20,
      'file' => 'includes/invite.admin.inc',
    );
  }
  return $items;
}