Skip to content

Commit 54788a8

Browse files
author
Zach Nanninga
committed
ISSUE-30286 - Change layout update removal button rendering from a block to directly in the template to prevent inaccurate js element selection in SecureHtmlRenderer event listener generation.
1 parent 26acabe commit 54788a8

File tree

2 files changed

+2
-20
lines changed
  • app/code/Magento/Widget

2 files changed

+2
-20
lines changed

app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main/Layout.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -315,25 +315,6 @@ public function getAddLayoutButtonHtml()
315315
return $button->toHtml();
316316
}
317317

318-
/**
319-
* Retrieve remove layout button html
320-
*
321-
* @return string
322-
*/
323-
public function getRemoveLayoutButtonHtml()
324-
{
325-
$button = $this->getLayout()->createBlock(
326-
\Magento\Backend\Block\Widget\Button::class
327-
)->setData(
328-
[
329-
'label' => $this->escapeHtmlAttr(__('Remove Layout Update')),
330-
'onclick' => 'WidgetInstance.removePageGroup(this)',
331-
'class' => 'action-delete',
332-
]
333-
);
334-
return $button->toHtml();
335-
}
336-
337318
/**
338319
* Prepare and retrieve page groups data of widget instance
339320
*

app/code/Magento/Widget/view/adminhtml/templates/instance/edit/layout.phtml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ var pageGroupTemplate = '<div class="fieldset-wrapper page_group_container" id="
3838
'<label for="widget_instance[<%- data.id %>][page_group]">Display on <span class="required">*</span></label>'+
3939
'{$block->getDisplayOnSelectHtml()}'+
4040
'<div class="actions">'+
41-
{$jsonHelper->jsonEncode($block->getRemoveLayoutButtonHtml())} +
41+
'<button title="{$escaper->escapeHtmlAttr(__('Remove Layout Update'))}" type="button"'+
42+
' class="action-default scalable action-delete" onclick="WidgetInstance.removePageGroup(this)" />'+
4243
'</div>'+
4344
'</div>'+
4445
'<div class="fieldset-wrapper-content">'+

0 commit comments

Comments
 (0)