private function CartBlockBase::getAvailableViews in Commerce Cart Blocks 8
1 call to CartBlockBase::getAvailableViews()
- CartBlockBase::getCartViews in src/
Plugin/ Block/ CartBlockBase.php - Gets the cart views for each cart.
File
- src/
Plugin/ Block/ CartBlockBase.php, line 373
Class
- CartBlockBase
- CartBlockBase class.
Namespace
Drupal\commerce_cart_blocks\Plugin\BlockCode
private function getAvailableViews(array $carts) {
try {
$orderTypeIds = $this
->getOrderTypeIds($carts);
$orderTypeStorage = $this->entityTypeManager
->getStorage('commerce_order_type');
$orderTypes = $orderTypeStorage
->loadMultiple(array_unique($orderTypeIds));
$availableViews = [];
foreach ($orderTypeIds as $cartId => $order_type_id) {
/** @var \Drupal\commerce_order\Entity\OrderTypeInterface $order_type */
$order_type = $orderTypes[$order_type_id];
$availableViews[$cartId] = $order_type
->getThirdPartySetting('commerce_cart', 'cart_block_view', 'commerce_cart_block');
}
return $availableViews;
} catch (InvalidPluginDefinitionException $e) {
return [];
}
}