File tree Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Expand file tree Collapse file tree 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 99 <plugin name =" integernet-configurable-wysiwyg"
1010 type =" IntegerNet\ConfigurableWysiwyg\Plugin\WysiwygConfigProviderPlugin" sortOrder =" 10" />
1111 </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 >
1216
1317 <type name =" IntegerNet\ConfigurableWysiwyg\Plugin\WysiwygConfigProviderPlugin" >
1418 <arguments >
You can’t perform that action at this time.
0 commit comments