function uc_cart_preprocess_block in Ubercart 7.3
Same name and namespace in other branches
- 8.4 uc_cart/uc_cart.module \uc_cart_preprocess_block()
- 6.2 uc_cart/uc_cart.module \uc_cart_preprocess_block()
Preprocesses the cart block output to include the icon.
File
- uc_cart/
uc_cart.module, line 443
Code
function uc_cart_preprocess_block(&$variables) {
global $user;
if ($variables['block']->module == 'uc_cart' && $variables['block']->delta == 0 && $variables['block']->subject) {
// Build the cart image if enabled.
if (variable_get('uc_cart_block_image', TRUE)) {
$product_count = count(uc_cart_get_contents());
if (!$product_count) {
// Use the "empty" cart icon.
$icon_class = 'cart-block-icon-empty';
}
else {
// Otherwise use the "full" cart icon.
$icon_class = 'cart-block-icon-full';
}
}
else {
$icon_class = FALSE;
}
$variables['block']->subject = theme('uc_cart_block_title', array(
'title' => $variables['block']->subject,
'icon_class' => $icon_class,
'collapsible' => variable_get('uc_cart_block_collapsible', TRUE),
'collapsed' => variable_get('uc_cart_block_collapsed', TRUE),
));
}
}