You are here

function registration_menu in Entity Registration 7

Same name and namespace in other branches
  1. 8.2 registration.module \registration_menu()
  2. 8 registration.module \registration_menu()
  3. 7.2 registration.module \registration_menu()

Implements hook_menu().

File

./registration.module, line 157

Code

function registration_menu() {
  $items['admin/structure/registration'] = array(
    'title' => 'Registration',
    'description' => 'Administer Registration items, such as types, states, etc.',
    'page callback' => 'system_admin_menu_block_page',
    'access arguments' => array(
      'administer registration',
    ),
    'file' => 'system.admin.inc',
    'file path' => drupal_get_path('module', 'system'),
  );
  $items['registration/%registration'] = array(
    'title callback' => 'registration_page_title',
    'title arguments' => array(
      1,
    ),
    'page callback' => 'registration_view',
    'page arguments' => array(
      1,
    ),
    'access callback' => 'registration_own_access',
    'access arguments' => array(
      'view',
      1,
    ),
  );
  $items['registration/%registration/view'] = array(
    'title' => 'View',
    'page callback' => 'registration_view',
    'page arguments' => array(
      1,
    ),
    'access callback' => 'registration_own_access',
    'access arguments' => array(
      'view',
      1,
    ),
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items['registration/%registration/edit'] = array(
    'title' => 'Edit',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'registration_form',
      1,
    ),
    'access callback' => 'registration_own_access',
    'access arguments' => array(
      'update',
      1,
    ),
    'weight' => 10,
    'type' => MENU_LOCAL_TASK,
  );
  $items['registration/%registration/delete'] = array(
    'title' => 'Delete',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'registration_delete_confirm',
      1,
    ),
    'access callback' => 'registration_own_access',
    'access arguments' => array(
      'delete',
      1,
    ),
    'type' => MENU_CALLBACK,
  );
  $items['registration/%registration/%/%'] = array(
    'title' => 'Registration Access Check',
    'page callback' => 'registration_access_check_redirect',
    'page arguments' => array(
      1,
      2,
    ),
    'access callback' => 'registration_own_access',
    'access arguments' => array(
      2,
      1,
      3,
    ),
  );

  // Entity local tasks.
  foreach (registration_get_registration_instances() as $instance) {
    $type = $instance['entity_type'];
    if (!in_array($type, array(
      'registration',
      'registration_type',
    ))) {
      $hide_register_tab = isset($instance['settings']['hide_register_tab']) && $instance['settings']['hide_register_tab'];
      $items[$type . '/%entity_object/register'] = array(
        'load arguments' => array(
          $type,
        ),
        'title' => 'Register',
        'page callback' => 'registration_register_page',
        'page arguments' => array(
          0,
          1,
        ),
        'access callback' => 'registration_register_page_access',
        'access arguments' => array(
          0,
          1,
        ),
        'type' => $hide_register_tab ? MENU_CALLBACK : MENU_LOCAL_TASK,
      );
      $items[$type . '/%entity_object/registrations'] = array(
        'load arguments' => array(
          $type,
        ),
        'title' => 'Manage Registrations',
        'page callback' => 'registration_registrations_page',
        'page arguments' => array(
          0,
          1,
        ),
        'access callback' => 'registration_administer_registrations_access',
        'access arguments' => array(
          0,
          1,
        ),
        'type' => MENU_LOCAL_TASK,
      );
      $items[$type . '/%entity_object/registrations/list'] = array(
        'load arguments' => array(
          $type,
        ),
        'title' => 'Registrations',
        'page callback' => 'registration_registrations_page',
        'page arguments' => array(
          0,
          1,
        ),
        'access callback' => 'registration_administer_registrations_access',
        'access arguments' => array(
          0,
          1,
        ),
        'type' => MENU_DEFAULT_LOCAL_TASK,
      );
      $items[$type . '/%entity_object/registrations/settings'] = array(
        'load arguments' => array(
          $type,
        ),
        'title' => 'Settings',
        'page callback' => 'registration_entity_settings_page',
        'page arguments' => array(
          0,
          1,
        ),
        'access callback' => 'registration_administer_registrations_access',
        'access arguments' => array(
          0,
          1,
        ),
        'weight' => 9,
        'type' => MENU_LOCAL_TASK,
      );
      $items[$type . '/%entity_object/registrations/broadcast'] = array(
        'load arguments' => array(
          $type,
        ),
        'title' => 'Email Registrants',
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
          'registration_registrations_broadcast_form',
          0,
          1,
        ),
        'access callback' => 'registration_administer_registrations_access',
        'access arguments' => array(
          0,
          1,
        ),
        'weight' => 10,
        'type' => MENU_LOCAL_TASK,
      );
    }
  }
  if (module_exists('devel')) {
    $items['registration/%registration/devel'] = array(
      'title' => 'Devel',
      'page callback' => 'devel_load_object',
      'page arguments' => array(
        'node',
        1,
      ),
      'access arguments' => array(
        'access devel information',
      ),
      'type' => MENU_LOCAL_TASK,
      'file path' => drupal_get_path('module', 'devel'),
      'file' => 'devel.pages.inc',
      'weight' => 100,
    );
    $items['registration/%registration/devel/load'] = array(
      'title' => 'Load',
      'type' => MENU_DEFAULT_LOCAL_TASK,
    );
  }
  return $items;
}