-
Notifications
You must be signed in to change notification settings - Fork 9.4k
/
Copy pathRenderer.php
115 lines (107 loc) · 3.57 KB
/
Renderer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* Shopping cart downloadable item render block
*/
namespace Magento\Downloadable\Block\Checkout\Cart\Item;
use Magento\Framework\Pricing\PriceCurrencyInterface;
use Magento\Framework\View\Element\Message\InterpretationStrategyInterface;
/**
* Item renderer.
*
* @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);
}
}