123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- /**
- * Shopping cart downloadable item render block
- *
- * @author Magento Core Team <core@magentocommerce.com>
- */
- namespace Magento\Downloadable\Block\Checkout\Cart\Item;
- use Magento\Framework\Pricing\PriceCurrencyInterface;
- use Magento\Framework\View\Element\Message\InterpretationStrategyInterface;
- /**
- * @api
- * @since 100.0.2
- */
- class Renderer extends \Magento\Checkout\Block\Cart\Item\Renderer
- {
- /**
- * Downloadable catalog product configuration
- *
- * @var \Magento\Downloadable\Helper\Catalog\Product\Configuration
- */
- protected $_downloadableProductConfiguration = 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 $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 \Magento\Downloadable\Helper\Catalog\Product\Configuration $downloadableProductConfiguration
- * @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,
- \Magento\Downloadable\Helper\Catalog\Product\Configuration $downloadableProductConfiguration,
- array $data = []
- ) {
- $this->_downloadableProductConfiguration = $downloadableProductConfiguration;
- parent::__construct(
- $context,
- $productConfig,
- $checkoutSession,
- $imageBuilder,
- $urlHelper,
- $messageManager,
- $priceCurrency,
- $moduleManager,
- $messageInterpretationStrategy,
- $data
- );
- }
- /**
- * Retrieves item links options
- *
- * @return array
- */
- public function getLinks()
- {
- if (!$this->getItem()) {
- return [];
- }
- return $this->_downloadableProductConfiguration->getLinks($this->getItem());
- }
- /**
- * Return title of links section
- *
- * @return string
- */
- public function getLinksTitle()
- {
- return $this->_downloadableProductConfiguration->getLinksTitle($this->getProduct());
- }
- /**
- * Get list of all options for product
- *
- * @return array
- */
- public function getOptionList()
- {
- return $this->_downloadableProductConfiguration->getOptions($this->getItem());
- }
- /**
- * Get list of all options for product
- * @param \Magento\Catalog\Model\Product\Configuration\Item\ItemInterface $item
- * @return array
- */
- public function getOption($item)
- {
- return $this->_downloadableProductConfiguration->getOptions($item);
- }
- }
|