function uc_recurring_menu in Ubercart 5
Implementation of hook_menu().
File
- payment/
uc_recurring/ uc_recurring.module, line 22 - Allows you to add a recurring fee to a product/SKU to handle subscription type services.
Code
function uc_recurring_menu($may_cache) {
$items = array();
global $user;
if ($may_cache) {
$items[] = array(
'path' => 'admin/store/orders/recurring',
'title' => t('Recurring fees'),
'description' => t('View the recurring fees on your orders.'),
'callback' => 'uc_recurring_admin',
'access' => user_access('administer recurring fees'),
'type' => MENU_NORMAL_ITEM,
'weight' => 5,
);
}
else {
if (arg(0) == 'user' && arg(2) == 'recurring' && intval(arg(3)) > 0) {
$items[] = array(
'path' => 'user/' . arg(1) . '/recurring/' . arg(3) . '/cancel',
'title' => t('Cancel the recurring fee?'),
'description' => t('Cancel a recurring fee.'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'uc_recurring_user_cancel_form',
arg(1),
arg(3),
),
'access' => $user->uid == intval(arg(1)) || user_access('administer recurring fees'),
'type' => MENU_CALLBACK,
);
}
if (arg(3) == 'recurring' && intval(arg(4)) > 0) {
if (arg(5) == 'charge') {
$items[] = array(
'path' => 'admin/store/orders/recurring/' . arg(4) . '/charge',
'title' => t('Charge recurring fee @fee?', array(
'@fee' => arg(4),
)),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'uc_recurring_admin_charge_form',
),
'access' => user_access('administer recurring fees'),
'type' => MENU_CALLBACK,
);
}
elseif (arg(5) == 'edit') {
$items[] = array(
'path' => 'admin/store/orders/recurring/' . arg(4) . '/edit',
'title' => t('Edit recurring fee @fee', array(
'@fee' => arg(4),
)),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'uc_recurring_admin_edit_form',
),
'access' => user_access('administer recurring fees'),
'type' => MENU_CALLBACK,
);
}
elseif (arg(5) == 'delete') {
$items[] = array(
'path' => 'admin/store/orders/recurring/' . arg(4) . '/delete',
'title' => t('Delete recurring fee @fee?', array(
'@fee' => arg(4),
)),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'uc_recurring_admin_delete_form',
),
'access' => user_access('administer recurring fees'),
'type' => MENU_CALLBACK,
);
}
}
}
return $items;
}