File tree 2 files changed +53
-0
lines changed 2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ /**
6
+ * integer_net Magento Module
7
+ *
8
+ * @category IntegerNet\ConfigurableWysiwyg\Plugin
9
+ * @package WysiwygConfigPlugin
10
+ * @copyright Copyright (c) 2022 integer_net GmbH (http://www.integer-net.de/)
11
+ * @author Andreas von Studnitz <avs@integer-net.de>
12
+ */
13
+
14
+ namespace IntegerNet \ConfigurableWysiwyg \Plugin ;
15
+
16
+ use Magento \Cms \Model \Wysiwyg \Config ;
17
+ use Magento \Framework \App \Config \ScopeConfigInterface ;
18
+ use Magento \Framework \Data \Wysiwyg \ConfigProviderInterface ;
19
+
20
+ class WysiwygConfigPlugin
21
+ {
22
+ /**
23
+ * @var ScopeConfigInterface
24
+ */
25
+ private $ scopeConfig ;
26
+
27
+ public function __construct (
28
+ ScopeConfigInterface $ scopeConfig
29
+ ) {
30
+ $ this ->scopeConfig = $ scopeConfig ;
31
+ }
32
+
33
+ public function beforeGetConfig (
34
+ \Magento \Cms \Model \Wysiwyg \Config $ subject ,
35
+ $ data = []
36
+ ) {
37
+ if (isset ($ data ['add_variables ' ])) {
38
+ $ data ['add_variables ' ] = $ this ->scopeConfig ->isSetFlag ('cms/wysiwyg/add_variable ' );
39
+ }
40
+ if (isset ($ data ['add_widgets ' ])) {
41
+ $ data ['add_widgets ' ] = $ this ->scopeConfig ->isSetFlag ('cms/wysiwyg/add_widget ' );
42
+ }
43
+ if (isset ($ data ['add_images ' ])) {
44
+ $ data ['add_images ' ] = $ this ->scopeConfig ->isSetFlag ('cms/wysiwyg/add_image ' );
45
+ }
46
+
47
+ return [$ data ];
48
+ }
49
+ }
Original file line number Diff line number Diff line change 9
9
<plugin name =" integernet-configurable-wysiwyg"
10
10
type =" IntegerNet\ConfigurableWysiwyg\Plugin\WysiwygConfigProviderPlugin" sortOrder =" 10" />
11
11
</type >
12
+ <type name =" Magento\Cms\Model\Wysiwyg\Config" >
13
+ <plugin name =" integernet-configurable-wysiwyg"
14
+ type =" IntegerNet\ConfigurableWysiwyg\Plugin\WysiwygConfigPlugin" sortOrder =" 10" />
15
+ </type >
12
16
13
17
<type name =" IntegerNet\ConfigurableWysiwyg\Plugin\WysiwygConfigProviderPlugin" >
14
18
<arguments >
You can’t perform that action at this time.
0 commit comments