5
5
*/
6
6
namespace Magento \Widget \Model \Template ;
7
7
8
+ use Magento \Email \Model \Template \Css ;
9
+ use Magento \Framework \App \Config \ScopeConfigInterface ;
10
+ use Magento \Framework \App \State ;
11
+ use Magento \Framework \Css \PreProcessor \Adapter \CssInliner ;
12
+ use Magento \Framework \Escaper ;
13
+ use Magento \Framework \Filesystem ;
14
+ use Magento \Framework \Filter \VariableResolverInterface ;
15
+ use Magento \Framework \Stdlib \StringUtils ;
16
+ use Magento \Framework \UrlInterface ;
17
+ use Magento \Framework \View \Asset \Repository ;
18
+ use Magento \Framework \View \LayoutFactory ;
19
+ use Magento \Framework \View \LayoutInterface ;
20
+ use Magento \Store \Model \StoreManagerInterface ;
21
+ use Magento \Variable \Model \Source \Variables ;
22
+ use Magento \Variable \Model \VariableFactory ;
23
+ use Magento \Widget \Block \BlockInterface ;
24
+ use Magento \Widget \Model \Widget ;
25
+ use Psr \Log \LoggerInterface ;
26
+
8
27
/**
9
28
* Template Filter Model
10
29
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -17,44 +36,55 @@ class Filter extends \Magento\Cms\Model\Template\Filter
17
36
protected $ _widgetResource ;
18
37
19
38
/**
20
- * @var \Magento\Widget\Model\ Widget
39
+ * @var Widget
21
40
*/
22
41
protected $ _widget ;
23
42
24
43
/**
25
- * @param \Magento\Framework\Stdlib\StringUtils $string
26
- * @param \Psr\Log\LoggerInterface $logger
27
- * @param \Magento\Framework\Escaper $escaper
28
- * @param \Magento\Framework\View\Asset\Repository $assetRepo
29
- * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
30
- * @param \Magento\Variable\Model\VariableFactory $coreVariableFactory
31
- * @param \Magento\Store\Model\StoreManagerInterface $storeManager
32
- * @param \Magento\Framework\View\LayoutInterface $layout
33
- * @param \Magento\Framework\View\LayoutFactory $layoutFactory
34
- * @param \Magento\Framework\App\State $appState
35
- * @param \Magento\Framework\UrlInterface $urlModel
36
- * @param \Pelago\Emogrifier $emogrifier
37
- * @param \Magento\Variable\Model\Source\Variables $configVariables
44
+ * Filter constructor.
45
+ * @param StringUtils $string
46
+ * @param LoggerInterface $logger
47
+ * @param Escaper $escaper
48
+ * @param Repository $assetRepo
49
+ * @param ScopeConfigInterface $scopeConfig
50
+ * @param VariableFactory $coreVariableFactory
51
+ * @param StoreManagerInterface $storeManager
52
+ * @param LayoutInterface $layout
53
+ * @param LayoutFactory $layoutFactory
54
+ * @param State $appState
55
+ * @param UrlInterface $urlModel
56
+ * @param Variables $configVariables
57
+ * @param VariableResolverInterface $variableResolver
58
+ * @param Css\Processor $cssProcessor
59
+ * @param Filesystem $pubDirectory
60
+ * @param CssInliner $cssInliner
38
61
* @param \Magento\Widget\Model\ResourceModel\Widget $widgetResource
39
- * @param \Magento\Widget\Model\Widget $widget
62
+ * @param Widget $widget
63
+ * @param array $variables
64
+ * @param array $directiveProcessors
40
65
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
41
66
*/
42
67
public function __construct (
43
- \Magento \Framework \Stdlib \StringUtils $ string ,
44
- \Psr \Log \LoggerInterface $ logger ,
45
- \Magento \Framework \Escaper $ escaper ,
46
- \Magento \Framework \View \Asset \Repository $ assetRepo ,
47
- \Magento \Framework \App \Config \ScopeConfigInterface $ scopeConfig ,
48
- \Magento \Variable \Model \VariableFactory $ coreVariableFactory ,
49
- \Magento \Store \Model \StoreManagerInterface $ storeManager ,
50
- \Magento \Framework \View \LayoutInterface $ layout ,
51
- \Magento \Framework \View \LayoutFactory $ layoutFactory ,
52
- \Magento \Framework \App \State $ appState ,
53
- \Magento \Framework \UrlInterface $ urlModel ,
54
- \Pelago \Emogrifier $ emogrifier ,
55
- \Magento \Variable \Model \Source \Variables $ configVariables ,
68
+ StringUtils $ string ,
69
+ LoggerInterface $ logger ,
70
+ Escaper $ escaper ,
71
+ Repository $ assetRepo ,
72
+ ScopeConfigInterface $ scopeConfig ,
73
+ VariableFactory $ coreVariableFactory ,
74
+ StoreManagerInterface $ storeManager ,
75
+ LayoutInterface $ layout ,
76
+ LayoutFactory $ layoutFactory ,
77
+ State $ appState ,
78
+ UrlInterface $ urlModel ,
79
+ Variables $ configVariables ,
80
+ VariableResolverInterface $ variableResolver ,
81
+ Css \Processor $ cssProcessor ,
82
+ Filesystem $ pubDirectory ,
83
+ CssInliner $ cssInliner ,
56
84
\Magento \Widget \Model \ResourceModel \Widget $ widgetResource ,
57
- \Magento \Widget \Model \Widget $ widget
85
+ Widget $ widget ,
86
+ $ variables = [],
87
+ array $ directiveProcessors = []
58
88
) {
59
89
$ this ->_widgetResource = $ widgetResource ;
60
90
$ this ->_widget = $ widget ;
@@ -70,8 +100,13 @@ public function __construct(
70
100
$ layoutFactory ,
71
101
$ appState ,
72
102
$ urlModel ,
73
- $ emogrifier ,
74
- $ configVariables
103
+ $ configVariables ,
104
+ $ variableResolver ,
105
+ $ cssProcessor ,
106
+ $ pubDirectory ,
107
+ $ cssInliner ,
108
+ $ variables ,
109
+ $ directiveProcessors
75
110
);
76
111
}
77
112
@@ -114,7 +149,7 @@ public function generateWidget($construction)
114
149
115
150
// define widget block and check the type is instance of Widget Interface
116
151
$ widget = $ this ->_layout ->createBlock ($ type , $ name , ['data ' => $ params ]);
117
- if (!$ widget instanceof \ Magento \ Widget \ Block \ BlockInterface) {
152
+ if (!$ widget instanceof BlockInterface) {
118
153
return '' ;
119
154
}
120
155
@@ -140,8 +175,9 @@ public function widgetDirective($construction)
140
175
*/
141
176
public function mediaDirective ($ construction )
142
177
{
178
+ // phpcs:disable Magento2.Functions.DiscouragedFunction
143
179
$ params = $ this ->getParameters (html_entity_decode ($ construction [2 ], ENT_QUOTES ));
144
180
return $ this ->_storeManager ->getStore ()
145
- ->getBaseUrl (\ Magento \ Framework \ UrlInterface::URL_TYPE_MEDIA ) . $ params ['url ' ];
181
+ ->getBaseUrl (UrlInterface::URL_TYPE_MEDIA ) . $ params ['url ' ];
146
182
}
147
183
}
0 commit comments