8
8
9
9
use Magento \Backend \Model \UrlInterface as BackendUrlInterface ;
10
10
use Magento \Cms \Helper \Wysiwyg \Images ;
11
+ use Magento \Framework \App \ObjectManager ;
11
12
use Magento \Framework \View \Element \UiComponentFactory ;
12
13
use Magento \Framework \View \Element \UiComponent \ContextInterface ;
14
+ use Magento \Ui \Component \Form \Element \DataType \Media \OpenDialogUrl ;
13
15
use Magento \Variable \Model \Variable \Config as VariableConfig ;
14
16
15
17
/**
@@ -39,12 +41,18 @@ class HtmlCode extends \Magento\Ui\Component\Form\Field
39
41
*/
40
42
private $ currentTreePath ;
41
43
44
+ /**
45
+ * @var OpenDialogUrl
46
+ */
47
+ private $ openDialogUrl ;
48
+
42
49
/**
43
50
* @param ContextInterface $context
44
51
* @param UiComponentFactory $uiComponentFactory
45
52
* @param BackendUrlInterface $backendUrl
46
53
* @param Images $imagesHelper
47
54
* @param VariableConfig $variableConfig
55
+ * @param OpenDialogUrl|null $openDialogUrl
48
56
* @param string $currentTreePath
49
57
* @param array $components
50
58
* @param array $data
@@ -55,6 +63,7 @@ public function __construct(
55
63
BackendUrlInterface $ backendUrl ,
56
64
Images $ imagesHelper ,
57
65
VariableConfig $ variableConfig ,
66
+ OpenDialogUrl $ openDialogUrl = null ,
58
67
$ currentTreePath = 'wysiwyg ' ,
59
68
$ components = [],
60
69
array $ data = []
@@ -63,6 +72,7 @@ public function __construct(
63
72
$ this ->imagesHelper = $ imagesHelper ;
64
73
$ this ->variableConfig = $ variableConfig ;
65
74
$ this ->currentTreePath = $ currentTreePath ;
75
+ $ this ->openDialogUrl = $ openDialogUrl ?: ObjectManager::getInstance ()->get (OpenDialogUrl::class);
66
76
parent ::__construct ($ context , $ uiComponentFactory , $ components , $ data );
67
77
}
68
78
@@ -82,7 +92,7 @@ public function prepare()
82
92
]
83
93
);
84
94
$ config ['imageUrl ' ] = $ this ->backendUrl ->getUrl (
85
- ' cms/wysiwyg_images/index ' ,
95
+ $ this -> openDialogUrl -> get () ,
86
96
[
87
97
'current_tree_path ' => $ this ->imagesHelper ->idEncode ($ this ->currentTreePath ),
88
98
'target_element_id ' => self ::HTML_ID_PLACEHOLDER
0 commit comments