You are here

function uc_ajax_cart_menu in Ubercart AJAX Cart 5

Same name and namespace in other branches
  1. 6.2 uc_ajax_cart.module \uc_ajax_cart_menu()
  2. 6 uc_ajax_cart.module \uc_ajax_cart_menu()
  3. 7.2 uc_ajax_cart.module \uc_ajax_cart_menu()

File

./uc_ajax_cart.module, line 7

Code

function uc_ajax_cart_menu($mayCache) {

  /** Add standard js **/
  drupal_add_js(drupal_get_path('module', 'uc_ajax_cart') . '/js/jquery.ajax.cart.js');
  drupal_add_js(drupal_get_path('module', 'uc_ajax_cart') . '/js/forms.js');
  drupal_add_css(drupal_get_path('module', 'uc_ajax_cart') . '/css/ajaxcart.css');

  /** Get button text **/
  $txt = variable_get('uc_ajax_cart_button_txt', '');
  if (!empty($txt)) {
    $txt = t($txt);
  }
  else {
    $txt = false;
  }
  $settings = array(
    'url' => url('cart/ajax/update'),
    'text' => $txt,
    'disable' => variable_get('uc_ajax_cart_button_disable', ''),
    'class' => variable_get('uc_ajax_cart_button_class', 'disable'),
  );
  drupal_add_js(array(
    'uc_ajax_cart' => $settings,
  ), "setting");
  if ($mayCache) {
    $items[] = array(
      'path' => 'cart/ajax/update',
      'title' => t('Shopping ajax cart'),
      'description' => t('View/modify the contents of your shopping cart or proceed to checkout.'),
      'callback' => 'uc_cart_ajax_handler',
      'access' => user_access('access content'),
      'type' => MENU_CALLBACK,
    );
  }
  return $items;
}