You are here

function payment_menu in Payment 7

Implements hook_menu().

See also

payment_views_default_views()

File

./payment.module, line 114
Hook implementations and shared functions.

Code

function payment_menu() {

  // Payment pages.
  $items['payment/%entity_object'] = array(
    'load arguments' => array(
      'payment',
    ),
    'title' => 'Payment',
    'title callback' => 'payment_title',
    'title arguments' => array(
      1,
    ),
    'page callback' => 'payment_page_payment_view',
    'page arguments' => array(
      1,
    ),
    'access callback' => 'payment_access',
    'access arguments' => array(
      'view',
      1,
    ),
    'file' => 'payment.ui.inc',
  );
  $items['payment/%entity_object/view'] = array(
    'load arguments' => array(
      'payment',
    ),
    'title' => 'View',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
    'weight' => -10,
  );
  $items['payment/%entity_object/edit'] = array(
    'load arguments' => array(
      'payment',
    ),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'payment_form_standalone',
      1,
    ),
    'access callback' => 'payment_access',
    'access arguments' => array(
      'update',
      1,
    ),
    'title' => 'Edit',
    'type' => MENU_LOCAL_TASK,
    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
    'weight' => -9,
    'file' => 'payment.ui.inc',
  );
  $items['payment/%entity_object/delete'] = array(
    'load arguments' => array(
      'payment',
    ),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'payment_form_payment_delete',
      1,
    ),
    'access callback' => 'payment_access',
    'access arguments' => array(
      'delete',
      1,
    ),
    'title' => 'Delete',
    'type' => MENU_LOCAL_TASK,
    'context' => MENU_CONTEXT_INLINE,
    'weight' => -8,
    'file' => 'payment.ui.inc',
  );

  // Administration section.
  $items['admin/config/services/payment'] = array(
    'title' => 'Payment',
    'page callback' => 'system_admin_menu_block_page',
    'access arguments' => array(
      'access administration pages',
    ),
    'file' => 'system.admin.inc',
    'file path' => drupal_get_path('module', 'system'),
  );

  // Global configuration.
  $items['admin/config/services/payment/global'] = array(
    'title' => 'Global configuration',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'payment_form_global_configuration',
    ),
    'access arguments' => array(
      'payment.global.administer',
    ),
    'file' => 'payment.ui.inc',
  );

  // Payment method administration.
  $items['admin/config/services/payment/method/add'] = array(
    'title' => 'Add payment method',
    'page callback' => 'payment_page_payment_method_add_select_controller',
    'access callback' => 'payment_page_payment_method_add_select_controller_access',
    'file' => 'payment.ui.inc',
    'type' => MENU_NORMAL_ITEM | MENU_LOCAL_ACTION,
    'weight' => 1,
  );
  $items['admin/config/services/payment/method/add/%payment_method_controller'] = array(
    'title' => 'Add payment method',
    'title callback' => 'payment_method_form_add_title',
    'title arguments' => array(
      6,
    ),
    'page callback' => 'payment_method_form_add',
    'page arguments' => array(
      6,
    ),
    'access callback' => 'payment_method_form_add_access',
    'access arguments' => array(
      6,
    ),
    'file' => 'payment.ui.inc',
    'type' => MENU_CALLBACK,
  );
  $items['admin/config/services/payment/method/%entity_object'] = array(
    'load arguments' => array(
      'payment_method',
    ),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'payment_form_payment_method',
      5,
    ),
    'access callback' => 'payment_method_access',
    'access arguments' => array(
      'update',
      5,
    ),
    'title' => 'Payment method',
    'title callback' => 'payment_method_title',
    'title arguments' => array(
      5,
    ),
    'file' => 'payment.ui.inc',
  );
  $items['admin/config/services/payment/method/%entity_object/edit'] = array(
    'load arguments' => array(
      'payment_method',
    ),
    'title' => 'Edit',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'context' => MENU_CONTEXT_INLINE,
  );
  $items['admin/config/services/payment/method/%entity_object/enable'] = array(
    'load arguments' => array(
      'payment_method',
    ),
    'page callback' => 'payment_page_method_enable_disable',
    'page arguments' => array(
      'enable',
      5,
    ),
    'access callback' => 'payment_method_access_token',
    'access arguments' => array(
      7,
      'enable',
      5,
    ),
    'title' => 'Enable',
    'file' => 'payment.ui.inc',
    'type' => MENU_LOCAL_TASK,
    'context' => MENU_CONTEXT_INLINE,
    'weight' => 1,
  );
  $items['admin/config/services/payment/method/%entity_object/disable'] = array(
    'load arguments' => array(
      'payment_method',
    ),
    'page callback' => 'payment_page_method_enable_disable',
    'page arguments' => array(
      'disable',
      5,
    ),
    'access callback' => 'payment_method_access_token',
    'access arguments' => array(
      7,
      'disable',
      5,
    ),
    'title' => 'Disable',
    'file' => 'payment.ui.inc',
    'type' => MENU_LOCAL_TASK,
    'context' => MENU_CONTEXT_INLINE,
    'weight' => 1,
  );
  $items['admin/config/services/payment/method/%entity_object/clone'] = array(
    'load arguments' => array(
      'payment_method',
    ),
    'page callback' => 'payment_page_method_clone',
    'page arguments' => array(
      5,
    ),
    'access callback' => 'payment_method_access',
    'access arguments' => array(
      'clone',
      5,
    ),
    'title' => 'Clone',
    'file' => 'payment.ui.inc',
    'type' => MENU_LOCAL_TASK,
    'context' => MENU_CONTEXT_INLINE,
    'weight' => 2,
  );
  $items['admin/config/services/payment/method/%entity_object/delete'] = array(
    'load arguments' => array(
      'payment_method',
    ),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'payment_form_payment_method_delete',
      5,
    ),
    'access callback' => 'payment_method_access',
    'access arguments' => array(
      'delete',
      5,
    ),
    'title' => 'Delete',
    'file' => 'payment.ui.inc',
    'type' => MENU_LOCAL_TASK,
    'context' => MENU_CONTEXT_INLINE,
    'weight' => 3,
  );

  // Payment status overview.
  $items['admin/config/services/payment/status'] = array(
    'title' => 'Payment statuses',
    'page callback' => 'payment_page_status',
    'access arguments' => array(
      'payment.payment_status.view',
    ),
    'file' => 'payment.ui.inc',
    'weight' => 1,
  );

  // Placeholder pages in case certain dependencies have not been met.
  $base = array(
    'page callback' => 'payment_page_required_modules',
    'page arguments' => array(
      array(
        'views' => 'Views',
      ),
    ),
    'file' => 'payment.ui.inc',
    'menu_name' => 'management',
  );
  if (!module_exists('views')) {
    $items['admin/content/payment'] = array(
      'title' => 'Payments',
      'access callback' => 'payment_access',
      'access arguments' => array(
        'view',
      ),
    ) + $base;
    $items['admin/config/services/payment/method'] = array(
      'title' => 'Payment methods',
      'access callback' => 'payment_method_access',
      'access arguments' => array(
        'view',
      ),
    ) + $base;
    $items['user/%user/payment'] = array(
      'title' => 'Payments',
      'access arguments' => array(
        'payment.payment.view.own',
      ),
    ) + $base;
  }
  return $items;
}