7
7
8
8
namespace Magefan \Blog \Block \Adminhtml \Widget \Featured \Grid ;
9
9
10
- use Magento \Framework \App \ObjectManager ;
11
- use Magento \Framework \View \Helper \SecureHtmlRenderer ;
12
-
13
10
class Chooser extends \Magento \Widget \Block \Adminhtml \Widget \Chooser
14
11
{
15
- /**
16
- * @var SecureHtmlRenderer|null
17
- */
18
- protected $ secureRenderer ;
19
-
20
- /**
21
- * @param \Magento\Backend\Block\Template\Context $context
22
- * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder
23
- * @param \Magento\Framework\Data\Form\Element\Factory $elementFactory
24
- * @param array $data
25
- * @param SecureHtmlRenderer|null $secureRenderer
26
- */
27
- public function __construct (
28
- \Magento \Backend \Block \Template \Context $ context ,
29
- \Magento \Framework \Json \EncoderInterface $ jsonEncoder ,
30
- \Magento \Framework \Data \Form \Element \Factory $ elementFactory ,
31
- array $ data = [], ?SecureHtmlRenderer
32
- $ secureRenderer = null
33
- ) {
34
- $ this ->secureRenderer = $ secureRenderer ?? ObjectManager::getInstance ()->get (SecureHtmlRenderer::class);
35
- parent ::__construct ($ context , $ jsonEncoder , $ elementFactory , $ data , $ secureRenderer );
36
- }
37
-
38
12
/**
39
13
* @param string $chooserId
40
14
* @return string
41
15
*/
42
16
public function onClickJs (string $ chooserId ) : string
43
17
{
44
- $ buttonHtml = "<button id='addBtn' class='action-primary' ><span>Save </span></button> " ;
18
+ $ buttonHtml = "<button id='addBtn' class='action-primary' ><span>Use Selected Posts </span></button> " ;
45
19
$ js = '
46
20
var waitForElm = function(selector) {
47
21
return new Promise(resolve => {
@@ -203,9 +177,7 @@ protected function _toHtml() : string
203
177
<div id=" ' .
204
178
$ chooserId .
205
179
'advice-container" class="hidden"></div> ' .
206
- $ this ->secureRenderer ->renderTag (
207
- 'script ' ,
208
- [],
180
+ '<script> ' .
209
181
'require(["prototype", "mage/adminhtml/wysiwyg/widget"], function(){
210
182
//<![CDATA[
211
183
(function() {
@@ -239,8 +211,6 @@ protected function _toHtml() : string
239
211
})();
240
212
//]]>
241
213
});
242
- ' ,
243
- false
244
- );
214
+ ' . '</script> ' ;
245
215
}
246
216
}
0 commit comments