|
2 | 2 |
|
3 | 3 | namespace Cloudinary\Cloudinary\Model\Template;
|
4 | 4 |
|
5 |
| -use Cloudinary\Cloudinary\Core\Image\ImageFactory; |
6 |
| -use Cloudinary\Cloudinary\Core\UrlGenerator; |
7 | 5 | use Magento\Widget\Model\Template\Filter as WidgetFilter;
|
8 | 6 |
|
9 | 7 | class Filter extends WidgetFilter
|
10 | 8 | {
|
11 | 9 | /**
|
12 |
| - * @var ImageFactory |
13 |
| - */ |
14 |
| - private $imageFactory; |
15 |
| - |
16 |
| - /** |
17 |
| - * @var UrlGenerator |
18 |
| - */ |
19 |
| - private $urlGenerator; |
20 |
| - |
21 |
| - /** |
22 |
| - * @param \Magento\Framework\Stdlib\StringUtils $string |
23 |
| - * @param \Psr\Log\LoggerInterface $logger |
24 |
| - * @param \Magento\Framework\Escaper $escaper |
25 |
| - * @param \Magento\Framework\View\Asset\Repository $assetRepo |
26 |
| - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig |
27 |
| - * @param \Magento\Variable\Model\VariableFactory $coreVariableFactory |
28 |
| - * @param \Magento\Store\Model\StoreManagerInterface $storeManager |
29 |
| - * @param \Magento\Framework\View\LayoutInterface $layout |
30 |
| - * @param \Magento\Framework\View\LayoutFactory $layoutFactory |
31 |
| - * @param \Magento\Framework\App\State $appState |
32 |
| - * @param \Magento\Framework\UrlInterface $urlModel |
33 |
| - * @param \Pelago\Emogrifier $emogrifier |
34 |
| - * @param \Magento\Email\Model\Source\Variables $configVariables |
35 |
| - * @param \Magento\Widget\Model\ResourceModel\Widget $widgetResource |
36 |
| - * @param \Magento\Widget\Model\Widget $widget |
37 |
| - * @param ImageFactory $imageFactory |
38 |
| - * @param UrlGenerator $urlGenerator |
39 |
| - * @SuppressWarnings(PHPMD.ExcessiveParameterList) |
40 |
| - */ |
41 |
| - public function __construct( |
42 |
| - \Magento\Framework\Stdlib\StringUtils $string, |
43 |
| - \Psr\Log\LoggerInterface $logger, |
44 |
| - \Magento\Framework\Escaper $escaper, |
45 |
| - \Magento\Framework\View\Asset\Repository $assetRepo, |
46 |
| - \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, |
47 |
| - \Magento\Variable\Model\VariableFactory $coreVariableFactory, |
48 |
| - \Magento\Store\Model\StoreManagerInterface $storeManager, |
49 |
| - \Magento\Framework\View\LayoutInterface $layout, |
50 |
| - \Magento\Framework\View\LayoutFactory $layoutFactory, |
51 |
| - \Magento\Framework\App\State $appState, |
52 |
| - \Magento\Framework\UrlInterface $urlModel, |
53 |
| - \Pelago\Emogrifier $emogrifier, |
54 |
| - \Magento\Email\Model\Source\Variables $configVariables, |
55 |
| - \Magento\Widget\Model\ResourceModel\Widget $widgetResource, |
56 |
| - \Magento\Widget\Model\Widget $widget, |
57 |
| - ImageFactory $imageFactory, |
58 |
| - UrlGenerator $urlGenerator |
59 |
| - ) { |
60 |
| - $this->imageFactory = $imageFactory; |
61 |
| - $this->urlGenerator = $urlGenerator; |
62 |
| - |
63 |
| - parent::__construct( |
64 |
| - $string, |
65 |
| - $logger, |
66 |
| - $escaper, |
67 |
| - $assetRepo, |
68 |
| - $scopeConfig, |
69 |
| - $coreVariableFactory, |
70 |
| - $storeManager, |
71 |
| - $layout, |
72 |
| - $layoutFactory, |
73 |
| - $appState, |
74 |
| - $urlModel, |
75 |
| - $emogrifier, |
76 |
| - $configVariables, |
77 |
| - $widgetResource, |
78 |
| - $widget |
79 |
| - ); |
80 |
| - } |
81 |
| - |
82 |
| - /** |
83 |
| - * Retrieve media file URL directive |
| 10 | + * Return associative array of parameters *exposing $this->getParameters(). |
84 | 11 | *
|
85 |
| - * @param string[] $construction |
86 |
| - * @return string |
| 12 | + * @param string $value raw parameters |
| 13 | + * @return array |
87 | 14 | */
|
88 |
| - public function mediaDirective($construction) |
| 15 | + public function getParams($value) |
89 | 16 | {
|
90 |
| - $params = $this->getParameters($construction[2]); |
91 |
| - $storeManager = $this->_storeManager; |
92 |
| - |
93 |
| - $image = $this->imageFactory->build( |
94 |
| - $params['url'], |
95 |
| - function () use ($storeManager, $params) { |
96 |
| - return sprintf( |
97 |
| - '%s%s', |
98 |
| - $storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA), |
99 |
| - $params['url'] |
100 |
| - ); |
101 |
| - } |
102 |
| - ); |
103 |
| - |
104 |
| - return $this->urlGenerator->generateFor($image); |
| 17 | + return $this->getParameters($value); |
105 | 18 | }
|
106 | 19 | }
|
0 commit comments