File tree Expand file tree Collapse file tree 3 files changed +57
-10
lines changed
app/code/Magento/PageBuilder
Model/Config/ContentType/AdditionalData/Provider/Uploader Expand file tree Collapse file tree 3 files changed +57
-10
lines changed Original file line number Diff line number Diff line change 9
9
namespace Magento \PageBuilder \Model \Config \ContentType \AdditionalData \Provider \Uploader ;
10
10
11
11
use Magento \PageBuilder \Model \Config \ContentType \AdditionalData \ProviderInterface ;
12
- use Magento \Backend \ Model \ Url ;
12
+ use Magento \Framework \ FlagManager ;
13
13
14
14
/**
15
15
* Provides open dialog URL for media gallery slideout
16
16
*/
17
17
class OpenDialogUrl implements ProviderInterface
18
18
{
19
+ private const MEDIA_GALLERY_OPEN_URL = 'open_dialog_url ' ;
20
+
19
21
/**
20
- * @var Url
22
+ * @var FlagManager
21
23
*/
22
- private $ urlBuilder ;
24
+ private $ scopeConfig ;
23
25
24
26
/**
25
27
* @param Url $urlBuilder
26
28
*/
27
- public function __construct (Url $ urlBuilder )
28
- {
29
- $ this ->urlBuilder = $ urlBuilder ;
29
+ public function __construct (
30
+ FlagManager $ scopeConfig
31
+ ) {
32
+ $ this ->scopeConfig = $ scopeConfig ;
30
33
}
31
34
32
35
/**
@@ -35,10 +38,7 @@ public function __construct(Url $urlBuilder)
35
38
public function getData (string $ itemName ) : array
36
39
{
37
40
return [
38
- $ itemName => $ this ->urlBuilder ->getUrl (
39
- 'cms/wysiwyg_images/index ' ,
40
- ['_secure ' => true ]
41
- )
41
+ $ itemName => $ this ->scopeConfig ->getFlagData (self ::MEDIA_GALLERY_OPEN_URL )
42
42
];
43
43
}
44
44
}
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 \PageBuilder \Plugin ;
9
+
10
+ use Magento \Ui \Component \Form \Element \DataType \Media \Image ;
11
+ use Magento \Framework \FlagManager ;
12
+
13
+ /**
14
+ * Plugin to set open media gallery dialog URL
15
+ */
16
+ class SetOpenDialogUrl
17
+ {
18
+ private const MEDIA_GALLERY_OPEN_URL = 'open_dialog_url ' ;
19
+
20
+ /**
21
+ * @var FlagManager
22
+ */
23
+ private $ config ;
24
+
25
+ /**
26
+ * @param FlagManager $config
27
+ */
28
+ public function __construct (FlagManager $ config )
29
+ {
30
+ $ this ->config = $ config ;
31
+ }
32
+
33
+ /**
34
+ * Set open media gallery dialog URL for image-uploader component
35
+ *
36
+ * @param Image $component
37
+ */
38
+ public function afterPrepare (Image $ component ): void
39
+ {
40
+ $ data = $ component ->getData ();
41
+
42
+ $ this ->config ->saveFlag (self ::MEDIA_GALLERY_OPEN_URL , $ data ['config ' ]['mediaGallery ' ]['openDialogUrl ' ]);
43
+ }
44
+ }
Original file line number Diff line number Diff line change 12
12
<type name =" Magento\Catalog\Block\Product\ImageFactory" >
13
13
<plugin name =" designLoader" type =" Magento\PageBuilder\Plugin\DesignLoader" />
14
14
</type >
15
+ <type name =" Magento\Ui\Component\Form\Element\DataType\Media\Image" >
16
+ <plugin name =" setOpenDialogUrl" type =" Magento\PageBuilder\Plugin\SetOpenDialogUrl" />
17
+ </type >
15
18
<virtualType name =" Magento\PageBuilder\Block\Adminhtml\ContentType\Edit\ModalCloseButton" type =" Magento\PageBuilder\Block\Adminhtml\ContentType\Edit\CloseButton" >
16
19
<arguments >
17
20
<argument name =" targetName" xsi : type =" string" >ns = pagebuilder_modal_form, index = modal</argument >
You can’t perform that action at this time.
0 commit comments