File tree Expand file tree Collapse file tree 5 files changed +101
-3
lines changed
dev/tests/integration/testsuite/Magento/Tinymce3/Model/Wysiwyg Expand file tree Collapse file tree 5 files changed +101
-3
lines changed Original file line number Diff line number Diff line change @@ -89,8 +89,6 @@ class Config extends \Magento\Framework\DataObject implements ConfigInterface
89
89
90
90
/**
91
91
* @var array
92
- * @deprecated
93
- * @see \Magento\Cms\Model\Wysiwyg\Gallery\DefaultConfigProvider
94
92
*/
95
93
protected $ _windowSize ;
96
94
@@ -207,6 +205,12 @@ public function getConfig($data = [])
207
205
208
206
if ($ this ->_authorization ->isAllowed ('Magento_Cms::media_gallery ' )) {
209
207
$ this ->configProvider ->processGalleryConfig ($ config );
208
+ $ config ->addData (
209
+ [
210
+ 'files_browser_window_width ' => $ this ->_windowSize ['width ' ],
211
+ 'files_browser_window_height ' => $ this ->_windowSize ['height ' ],
212
+ ]
213
+ );
210
214
}
211
215
if ($ config ->getData ('add_widgets ' )) {
212
216
$ this ->configProvider ->processWidgetConfig ($ config );
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+ declare (strict_types=1 );
7
+
8
+ namespace Magento \Tinymce3 \Model \Config \Gallery ;
9
+
10
+ /**
11
+ * Class Config adds information about required configurations to display media gallery of tinymce3 editor
12
+ *
13
+ * @deprecated use \Magento\Cms\Model\Wysiwyg\DefaultConfigProvider instead
14
+ */
15
+ class Config implements \Magento \Framework \Data \Wysiwyg \ConfigProviderInterface
16
+ {
17
+ /**
18
+ * @var \Magento\Backend\Model\UrlInterface
19
+ */
20
+ private $ backendUrl ;
21
+
22
+ /**
23
+ * @param \Magento\Backend\Model\UrlInterface $backendUrl
24
+ */
25
+ public function __construct (
26
+ \Magento \Backend \Model \UrlInterface $ backendUrl
27
+ ) {
28
+ $ this ->backendUrl = $ backendUrl ;
29
+ }
30
+
31
+ /**
32
+ * Returns media gallery config
33
+ *
34
+ * @param \Magento\Framework\DataObject $config
35
+ * @return \Magento\Framework\DataObject
36
+ */
37
+ public function getConfig (\Magento \Framework \DataObject $ config ) : \Magento \Framework \DataObject
38
+ {
39
+ $ config ->addData (
40
+ [
41
+ 'add_images ' => true ,
42
+ 'files_browser_window_url ' => $ this ->backendUrl ->getUrl ('cms/wysiwyg_images/index ' ),
43
+ ]
44
+ );
45
+
46
+ return $ config ;
47
+ }
48
+ }
Original file line number Diff line number Diff line change 4
4
"require" : {
5
5
"php" : " ~7.1.3||~7.2.0" ,
6
6
"magento/framework" : " *" ,
7
+ "magento/module-backend" : " *" ,
7
8
"magento/module-ui" : " *" ,
8
9
"magento/module-variable" : " *" ,
9
10
"magento/module-widget" : " *"
11
+
10
12
},
11
13
"suggest" : {
12
14
"magento/module-cms" : " *"
Original file line number Diff line number Diff line change 22
22
<item name =" Magento_Tinymce3/tinymce3Adapter" xsi : type =" string" >Magento\Tinymce3\Model\Config\Widget\Config</item >
23
23
</argument >
24
24
<argument name =" galleryConfigProvider" xsi : type =" array" >
25
- <item name =" Magento_Tinymce3/tinymce3Adapter" xsi : type =" string" >Magento\Cms \Model\WysiwygDefaultConfig </item >
25
+ <item name =" Magento_Tinymce3/tinymce3Adapter" xsi : type =" string" >Magento\Tinymce3 \Model\Config\Gallery\Config </item >
26
26
</argument >
27
27
</arguments >
28
28
</type >
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+ declare (strict_types=1 );
7
+
8
+
9
+ namespace Magento \Tinymce3 \Model \Wysiwyg ;
10
+
11
+ use Magento \TestFramework \Helper \Bootstrap ;
12
+ use Magento \Framework \AuthorizationInterface ;
13
+
14
+ /**
15
+ * @magentoAppArea adminhtml
16
+ */
17
+ class CompositeConfigProviderTest extends \PHPUnit \Framework \TestCase
18
+ {
19
+ /**
20
+ * Test enabled module is able to modify WYSIWYG config
21
+ *
22
+ * @return void
23
+ *
24
+ * @magentoConfigFixture default/cms/wysiwyg/editor Magento_Tinymce3/tinymce3Adapter
25
+ */
26
+ public function testTestModuleEnabledModuleIsAbleToModifyConfig ()
27
+ {
28
+ $ objectManager = Bootstrap::getObjectManager ();
29
+ $ objectManager ->configure ([
30
+ 'preferences ' => [
31
+ AuthorizationInterface::class => \Magento \Backend \Model \Search \AuthorizationMock::class
32
+ ]
33
+ ]);
34
+ $ compositeConfigProvider = $ objectManager ->create (\Magento \Cms \Model \Wysiwyg \CompositeConfigProvider::class);
35
+ $ model = $ objectManager ->create (
36
+ \Magento \Cms \Model \Wysiwyg \Config::class,
37
+ ['configProvider ' => $ compositeConfigProvider ]
38
+ );
39
+ $ config = $ model ->getConfig ();
40
+ $ this ->assertArrayHasKey ('add_images ' , $ config );
41
+ $ this ->assertArrayHasKey ('files_browser_window_url ' , $ config );
42
+ $ this ->assertTrue ($ config ['add_images ' ]);
43
+ }
44
+ }
You can’t perform that action at this time.
0 commit comments