1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* integer_net Magento Module |
7
|
|
|
* |
8
|
|
|
* @category IntegerNet\ConfigurableWysiwyg\Plugin |
9
|
|
|
* @package WysiwygConfigProviderPlugin |
10
|
|
|
* @copyright Copyright (c) 2020 integer_net GmbH (http://www.integer-net.de/) |
11
|
|
|
* @author Andreas von Studnitz <[email protected]> |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace IntegerNet\ConfigurableWysiwyg\Plugin; |
15
|
|
|
|
16
|
|
|
use Magento\Cms\Model\Wysiwyg\CompositeConfigProvider; |
|
|
|
|
17
|
|
|
use Magento\Framework\App\Config\ScopeConfigInterface; |
18
|
|
|
use Magento\Framework\Data\Wysiwyg\ConfigProviderInterface; |
19
|
|
|
|
20
|
|
|
class WysiwygConfigProviderPlugin |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* @var array |
24
|
|
|
*/ |
25
|
|
|
private $additionalSettings; |
26
|
|
|
/** |
27
|
|
|
* @var ScopeConfigInterface |
28
|
|
|
*/ |
29
|
|
|
private $scopeConfig; |
30
|
|
|
/** |
31
|
|
|
* @var CompositeConfigProvider |
32
|
|
|
*/ |
33
|
|
|
private $compositeConfigProvider; |
34
|
|
|
|
35
|
|
|
public function __construct( |
36
|
|
|
array $additionalSettings, |
37
|
|
|
ScopeConfigInterface $scopeConfig, |
38
|
|
|
CompositeConfigProvider $compositeConfigProvider |
39
|
|
|
) { |
40
|
|
|
$this->additionalSettings = $additionalSettings; |
41
|
|
|
$this->scopeConfig = $scopeConfig; |
42
|
|
|
$this->compositeConfigProvider = $compositeConfigProvider; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
public function afterGetConfig( |
46
|
|
|
ConfigProviderInterface $subject, |
|
|
|
|
47
|
|
|
\Magento\Framework\DataObject $result |
48
|
|
|
) { |
49
|
|
|
$toolbar = implode(' ', explode(',', $this->scopeConfig->getValue('admin/wysiwyg/toolbar'))); |
50
|
|
|
|
51
|
|
|
$result->setData( |
52
|
|
|
'tinymce4', |
53
|
|
|
[ |
54
|
|
|
'toolbar' => $toolbar, |
55
|
|
|
'plugins' => $result->getData('tinymce4')['plugins'], |
56
|
|
|
'content_css' => $result->getData('tinymce4')['content_css'], |
57
|
|
|
] |
58
|
|
|
); |
59
|
|
|
|
60
|
|
|
//$result->setData('settings', $this->additionalSettings); |
61
|
|
|
$result->setData('add_variables', $this->scopeConfig->isSetFlag('cms/wysiwyg/add_variable')); |
62
|
|
|
$result->setData('add_widgets', $this->scopeConfig->isSetFlag('cms/wysiwyg/add_widget')); |
63
|
|
|
$result->setData('add_images', $this->scopeConfig->isSetFlag('cms/wysiwyg/add_image')); |
64
|
|
|
|
65
|
|
|
$plugins = $result->getData('plugins'); |
66
|
|
|
foreach ($plugins as $key => $plugin) { |
67
|
|
|
if ($plugin['name'] == 'magentovariable' && !$this->scopeConfig->isSetFlag('cms/wysiwyg/add_variable')) { |
68
|
|
|
unset($plugins[$key]); |
69
|
|
|
} |
70
|
|
|
if ($plugin['name'] == 'magentowidget' && !$this->scopeConfig->isSetFlag('cms/wysiwyg/add_widget')) { |
71
|
|
|
unset($plugins[$key]); |
72
|
|
|
} |
73
|
|
|
if ($plugin['name'] == 'image' && !$this->scopeConfig->isSetFlag('cms/wysiwyg/add_image')) { |
74
|
|
|
unset($plugins[$key]); |
75
|
|
|
$result->unsetData('files_browser_window_width'); |
76
|
|
|
$result->unsetData('files_browser_window_height'); |
77
|
|
|
$result->unsetData('files_browser_window_url'); |
78
|
|
|
} |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
$result->setData('plugins', array_values($plugins)); |
82
|
|
|
|
83
|
|
|
return $result; |
84
|
|
|
} |
85
|
|
|
} |
86
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths