You are here

function registration_menu in Entity Registration 8.2

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

@FIXME This implementation of hook_menu() cannot be automatically converted because it contains logic (i.e., branching statements, function calls, object instantiation, etc.) You will need to convert it manually. Sorry!

For more information on how to convert hook_menu() to Drupal 8's new routing and linking systems, see https://api.drupal.org/api/drupal/core%21includes%21menu.inc/group/menu/8

File

./registration.module, line 155

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' => 'entity_access',
    'access arguments' => array(
      'view',
      'registration',
      1,
    ),
  );
  $items['registration/%registration/view'] = array(
    'title' => 'View',
    'page callback' => 'registration_view',
    'page arguments' => array(
      1,
    ),
    'access callback' => 'entity_access',
    'access arguments' => array(
      'view',
      'registration',
      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' => 'entity_access',
    'access arguments' => array(
      'update',
      'registration',
      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' => 'entity_access',
    'access arguments' => array(
      'delete',
      'registration',
      1,
    ),
    'type' => MENU_CALLBACK,
  );

  // 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 (\Drupal::moduleHandler()
    ->moduleExists('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;
}