Skip to content

Commit 53feb79

Browse files
Merge MAGETWO-97066 into 2.2.8-bugfixes-180119
2 parents 8dcc1b4 + 60f12e6 commit 53feb79

File tree

5 files changed

+96
-346
lines changed

5 files changed

+96
-346
lines changed

app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,23 @@ protected function _construct()
9191
if (!$entityAttribute || !$entityAttribute->getIsUserDefined()) {
9292
$this->buttonList->remove('delete');
9393
} else {
94-
$this->buttonList->update('delete', 'label', __('Delete Attribute'));
94+
$this->buttonList->update(
95+
'delete',
96+
'onclick',
97+
sprintf(
98+
"deleteConfirm('%s','%s', %s)",
99+
__('Are you sure you want to do this?'),
100+
$this->getDeleteUrl(),
101+
json_encode(
102+
[
103+
'action' => '',
104+
'data' => [
105+
'form_key' => $this->getFormKey()
106+
]
107+
]
108+
)
109+
)
110+
);
95111
}
96112
}
97113

app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Delete.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,20 @@
66
*/
77
namespace Magento\Catalog\Controller\Adminhtml\Product\Attribute;
88

9+
use Magento\Framework\Exception\NotFoundException;
10+
911
class Delete extends \Magento\Catalog\Controller\Adminhtml\Product\Attribute
1012
{
1113
/**
1214
* @return \Magento\Backend\Model\View\Result\Redirect
15+
* @throws NotFoundException
1316
*/
1417
public function execute()
1518
{
19+
if (!$this->getRequest()->isPost()) {
20+
throw new NotFoundException(__('Page not found'));
21+
}
22+
1623
$id = $this->getRequest()->getParam('attribute_id');
1724
$resultRedirect = $this->resultRedirectFactory->create();
1825
if ($id) {

app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
use Magento\Framework\Registry;
3030
use Magento\Framework\View\LayoutFactory;
3131
use Magento\Framework\View\Result\PageFactory;
32+
use Magento\Framework\Exception\NotFoundException;
3233

3334
/**
3435
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -124,6 +125,10 @@ public function __construct(
124125
*/
125126
public function execute()
126127
{
128+
if (!$this->getRequest()->isPost()) {
129+
throw new NotFoundException(__('Page not found'));
130+
}
131+
127132
try {
128133
$optionData = $this->formDataSerializer->unserialize(
129134
$this->getRequest()->getParam('serialized_options', '[]')

0 commit comments

Comments
 (0)