function uc_cart_preprocess_block in Ubercart 8.4
Same name and namespace in other branches
- 6.2 uc_cart/uc_cart.module \uc_cart_preprocess_block()
- 7.3 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 166 - Handles all things concerning Ubercart's shopping cart.
Code
function uc_cart_preprocess_block(&$variables) {
$cart = \Drupal::service('uc_cart.manager')
->get();
if ($variables['plugin_id'] == 'uc_cart_block' && $variables['label']) {
$variables['label'] = [
'#theme' => 'uc_cart_block_title',
'#title' => $variables['label'],
'#show_icon' => $variables['configuration']['show_image'],
'#cart_empty' => !$cart
->getContents(),
'#collapsible' => $variables['configuration']['collapsible'],
'#collapsed' => $variables['configuration']['collapsed'],
];
}
}