You are here

function uc_payment_menu in Ubercart 5

Same name and namespace in other branches
  1. 6.2 payment/uc_payment/uc_payment.module \uc_payment_menu()
  2. 7.3 payment/uc_payment/uc_payment.module \uc_payment_menu()

Implementation of hook_menu().

File

payment/uc_payment/uc_payment.module, line 26

Code

function uc_payment_menu($may_cache) {
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/store/settings/payment',
      'title' => t('Payment settings'),
      'callback' => 'uc_payment_settings_overview',
      'access' => user_access('administer store'),
      'description' => t('Configure the payment settings.'),
    );
    $items[] = array(
      'path' => 'admin/store/settings/payment/overview',
      'title' => t('Overview'),
      'access' => user_access('administer store'),
      'description' => t('View the payment settings.'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -10,
    );
    $items[] = array(
      'path' => 'admin/store/settings/payment/edit',
      'title' => t('Edit'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'uc_payment_settings_form',
      ),
      'access' => user_access('administer store'),
      'description' => t('Edit the payment settings.'),
      'type' => MENU_LOCAL_TASK,
      'weight' => -5,
    );
    $items[] = array(
      'path' => 'admin/store/settings/payment/edit/basic',
      'title' => t('Payment settings'),
      'access' => user_access('administer store'),
      'description' => t('Edit the basic payment settings.'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -10,
    );
    $items[] = array(
      'path' => 'admin/store/settings/payment/edit/methods',
      'title' => t('Payment methods'),
      'access' => user_access('administer store'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'uc_payment_methods_form',
      ),
      'description' => t('Edit the payment method settings.'),
      'type' => MENU_LOCAL_TASK,
      'weight' => -5,
    );
    $items[] = array(
      'path' => 'admin/store/settings/payment/edit/gateways',
      'title' => t('Payment gateways'),
      'access' => user_access('administer store'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'uc_payment_gateways_form',
      ),
      'description' => t('Edit the payment gateway settings.'),
      'type' => MENU_LOCAL_TASK,
      'weight' => 0,
    );
    $items[] = array(
      'path' => 'cart/checkout/line_items',
      'title' => t('Return order totals'),
      'callback' => 'uc_payment_get_totals',
      'access' => user_access('access content'),
      'type' => MENU_CALLBACK,
    );
  }
  else {
    $items[] = array(
      'path' => 'cart/checkout/payment_details/' . arg(3),
      'title' => t('Payment details'),
      'description' => t('Add the payment details to the checkout pane.'),
      'callback' => 'uc_payment_get_details',
      'callback arguments' => array(
        arg(3),
      ),
      'access' => user_access('access content'),
      'type' => MENU_CALLBACK,
    );
    if (is_numeric(arg(3))) {
      $items[] = array(
        'path' => 'admin/store/orders/' . arg(3) . '/payment_details/' . arg(5),
        'title' => t('Payment details'),
        'description' => t('Add the payment details to the order pane.'),
        'callback' => 'uc_payment_get_details',
        'callback arguments' => array(
          arg(5),
          'order',
        ),
        'access' => user_access('edit orders'),
        'type' => MENU_CALLBACK,
      );
      $items[] = array(
        'path' => 'admin/store/orders/' . arg(3) . '/payments/select/' . arg(6),
        'title' => t('Select payment gateway'),
        'callback' => 'uc_payment_gateway_select',
        'callback arguments' => array(
          arg(3),
          arg(6),
        ),
        'access' => user_access('view all orders'),
        'type' => MENU_CALLBACK,
      );
      if (variable_get('uc_payment_tracking', TRUE)) {
        $items[] = array(
          'path' => 'admin/store/orders/' . arg(3) . '/payments',
          'title' => t('Payments'),
          'callback' => 'drupal_get_form',
          'callback arguments' => array(
            'uc_payment_by_order_form',
            arg(3),
          ),
          'access' => user_access('view payments'),
          'weight' => 5,
          'type' => MENU_LOCAL_TASK,
        );
      }
      if (is_numeric(arg(5)) && arg(6) == 'delete' && variable_get('uc_payment_deleting', TRUE)) {
        $items[] = array(
          'path' => 'admin/store/orders/' . arg(3) . '/payments/' . arg(5) . '/delete',
          'title' => t('Delete payment?'),
          'description' => t('Delete payment?'),
          'callback' => 'drupal_get_form',
          'callback arguments' => array(
            'uc_payment_delete_confirm_form',
            arg(3),
            arg(5),
          ),
          'access' => user_access('delete payments'),
          'type' => MENU_CALLBACK,
        );
      }
    }
  }
  return $items;
}