| Current Path : /home/rtorresani/www/vendor/magento/module-bundle/Block/Checkout/Cart/Item/ |
| Current File : //home/rtorresani/www/vendor/magento/module-bundle/Block/Checkout/Cart/Item/Renderer.php |
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Bundle\Block\Checkout\Cart\Item;
use Magento\Bundle\Helper\Catalog\Product\Configuration;
use Magento\Framework\Pricing\PriceCurrencyInterface;
use Magento\Framework\View\Element\Message\InterpretationStrategyInterface;
/**
* Shopping cart item render block
*
* @api
* @since 100.0.2
*/
class Renderer extends \Magento\Checkout\Block\Cart\Item\Renderer
{
/**
* Bundle catalog product configuration
*
* @var Configuration
*/
protected $_bundleProductConfiguration = null;
/**
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Catalog\Helper\Product\Configuration $productConfig
* @param \Magento\Checkout\Model\Session $checkoutSession
* @param \Magento\Catalog\Block\Product\ImageBuilder|\Magento\Catalog\Helper\Image $imageBuilder
* @param \Magento\Framework\Url\Helper\Data $urlHelper
* @param \Magento\Framework\Message\ManagerInterface $messageManager
* @param PriceCurrencyInterface $priceCurrency
* @param \Magento\Framework\Module\Manager $moduleManager
* @param InterpretationStrategyInterface $messageInterpretationStrategy
* @param Configuration $bundleProductConfiguration
* @param array $data
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Catalog\Helper\Product\Configuration $productConfig,
\Magento\Checkout\Model\Session $checkoutSession,
\Magento\Catalog\Block\Product\ImageBuilder $imageBuilder,
\Magento\Framework\Url\Helper\Data $urlHelper,
\Magento\Framework\Message\ManagerInterface $messageManager,
PriceCurrencyInterface $priceCurrency,
\Magento\Framework\Module\Manager $moduleManager,
InterpretationStrategyInterface $messageInterpretationStrategy,
Configuration $bundleProductConfiguration,
array $data = []
) {
$this->_bundleProductConfiguration = $bundleProductConfiguration;
parent::__construct(
$context,
$productConfig,
$checkoutSession,
$imageBuilder,
$urlHelper,
$messageManager,
$priceCurrency,
$moduleManager,
$messageInterpretationStrategy,
$data
);
$this->_isScopePrivate = true;
}
/**
* Overloaded method for getting list of bundle options
*
* Caches result in quote item, because it can be used in cart 'recent view' and on same page in cart checkout
*
* @return array
*/
public function getOptionList()
{
return $this->_bundleProductConfiguration->getOptions($this->getItem());
}
/**
* Return cart item error messages
*
* @return array
*/
public function getMessages()
{
$messages = [];
$quoteItem = $this->getItem();
// Add basic messages occurring during this page load
$baseMessages = $quoteItem->getMessage(false);
if ($baseMessages) {
foreach ($baseMessages as $message) {
$messages[] = ['text' => $message, 'type' => $quoteItem->getHasError() ? 'error' : 'notice'];
}
}
return $messages;
}
}