function _uc_ajax_cart_init in Ubercart AJAX Cart 6.2
Contains the initialization logic for uc_ajax_cart. Called upon by either hook_init() (for always-enabled ajax functionality) or hook_block (for ajax only when the block is present on the page).
2 calls to _uc_ajax_cart_init()
- uc_ajax_cart_block in ./
uc_ajax_cart.module - uc_ajax_cart_init in ./
uc_ajax_cart.module - Implements hook_init().
File
- ./
uc_ajax_cart.module, line 294
Code
function _uc_ajax_cart_init() {
static $loaded;
if (isset($loaded) && $loaded === TRUE) {
return;
}
drupal_add_js('misc/jquery.form.js');
drupal_add_js(drupal_get_path('module', 'uc_ajax_cart') . '/js/jquery.blockUI.js');
drupal_add_js(drupal_get_path('module', 'uc_ajax_cart') . '/js/uc_ajax_cart.js');
drupal_add_js(drupal_get_path('module', 'uc_ajax_cart') . '/js/jquery.cookie.js');
drupal_add_css(drupal_get_path('module', 'uc_ajax_cart') . '/css/uc_ajax_cart.css');
$settings = array(
'CALLBACK' => url(UC_AJAX_CART_ADD_CALLBACK),
'SHOW_CALLBACK' => url(UC_AJAX_CART_SHOW_CALLBACK),
'CART_LINK_CALLBACK' => url(UC_AJAX_CART_LINK_CALLBACK),
'BLOCK_UI' => (int) variable_get('ajax_cart_message_effect', UC_AJAX_CART_DEFAULT_EFFECT),
'TIMEOUT' => (int) variable_get('ajax_cart_message_timeout', UC_AJAX_CART_DEFAULT_TIMEOUT),
'UPDATE_CALLBACK' => url(UC_AJAX_CART_UPDATE_CALLBACK),
'UPDATE' => variable_get('uc_ajax_cart_closed_update', 0),
'CART_VIEW_ON' => variable_get('uc_ajax_cart_cart_view', 0),
'SHOW_VIEW_CALLBACK' => url(UC_AJAX_CART_SHOW_VIEW_CALLBACK),
'TRACK_CLOSED_STATE' => variable_get('uc_ajax_cart_track_closed_state', 0),
'INITIAL_CLOSED_STATE' => variable_get('uc_ajax_cart_closed_default', FALSE),
'CART_PANE_EFFECT' => variable_get('uc_ajax_cart_pane_effect', 0),
'CART_PANE_EFFECT_DURATION' => (int) variable_get('uc_ajax_cart_pane_effect_duration', UC_AJAX_CART_DEFAULT_PANE_EFFECT_DURATION),
'HIDE_CART_OPERATIONS' => variable_get('uc_ajax_cart_hide_cart_op_msgs', FALSE),
'COLLAPSIBLE_CART' => variable_get('uc_ajax_cart_closed', 0),
);
$settings += uc_ajax_cart_get_messages();
if (($include_exclude = variable_get('uc_ajax_cart_include_exclude', 0)) && ($ajaxify_class = variable_get('uc_ajax_cart_ajaxify_class', ''))) {
$settings['AJAXIFY_CLASS_EXCLUDES'] = $include_exclude - 1;
$settings['AJAXIFY_CLASS'] = $ajaxify_class;
}
drupal_add_js(array(
'uc_ajax_cart' => $settings,
), 'setting');
$loaded = TRUE;
}