You are here

function uc_cart_links_menu in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_cart_links/uc_cart_links.module \uc_cart_links_menu()
  2. 7.3 uc_cart_links/uc_cart_links.module \uc_cart_links_menu()

Implementation of hook_menu().

File

uc_cart_links/uc_cart_links.module, line 19
Allows store owners to create links to add products to carts and send customers on to checkout.

Code

function uc_cart_links_menu($may_cache) {
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/store/settings/cart_links',
      'title' => t('Cart links settings'),
      'description' => t('Configure and craft special product add to cart links.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'uc_cart_links_settings_form',
      ),
      'access' => user_access('administer cart links'),
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'admin/store/reports/cart_links',
      'title' => t('Cart links clicks'),
      'description' => t('Track clicks through cart links.'),
      'callback' => 'uc_cart_links_report',
      'access' => user_access('view cart links report'),
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'admin/store/help/cart_links',
      'title' => t('Creating cart links'),
      'description' => t('Learn how to create cart links for your products.'),
      'callback' => 'uc_cart_links_creation_help',
      'access' => user_access('administer store'),
      'type' => MENU_NORMAL_ITEM,
    );
  }
  else {
    $items[] = array(
      'path' => 'cart/add/' . arg(2),
      'title' => t('Add to cart'),
      'callback' => 'uc_cart_links_process',
      'callback arguments' => array(
        arg(2),
      ),
      'access' => user_access('access content'),
      'type' => MENU_CALLBACK,
    );
  }
  return $items;
}