Skip to content

Commit af2d29a

Browse files
committed
#30388 : fix js error on edit review page
1 parent 68770fc commit af2d29a

File tree

1 file changed

+21
-16
lines changed
  • app/code/Magento/Review/Block/Adminhtml

1 file changed

+21
-16
lines changed

app/code/Magento/Review/Block/Adminhtml/Edit.php

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Review\Block\Adminhtml;
78

89
/**
@@ -44,7 +45,8 @@ public function __construct(
4445
\Magento\Review\Helper\Action\Pager $reviewActionPager,
4546
\Magento\Framework\Registry $registry,
4647
array $data = []
47-
) {
48+
)
49+
{
4850
$this->_coreRegistry = $registry;
4951
$this->_reviewActionPager = $reviewActionPager;
5052
$this->_reviewFactory = $reviewFactory;
@@ -78,12 +80,12 @@ protected function _construct()
7880
[
7981
'label' => __('Previous'),
8082
'onclick' => 'setLocation(\'' . $this->getUrl(
81-
'review/*/*',
82-
[
83-
'id' => $prevId,
84-
'ret' => $this->getRequest()->getParam('ret'),
85-
]
86-
) . '\')'
83+
'review/*/*',
84+
[
85+
'id' => $prevId,
86+
'ret' => $this->getRequest()->getParam('ret'),
87+
]
88+
) . '\')'
8789
],
8890
3,
8991
10
@@ -139,12 +141,12 @@ protected function _construct()
139141
[
140142
'label' => __('Next'),
141143
'onclick' => 'setLocation(\'' . $this->getUrl(
142-
'review/*/*',
143-
[
144-
'id' => $nextId,
145-
'ret' => $this->getRequest()->getParam('ret'),
146-
]
147-
) . '\')'
144+
'review/*/*',
145+
[
146+
'id' => $nextId,
147+
'ret' => $this->getRequest()->getParam('ret'),
148+
]
149+
) . '\')'
148150
],
149151
3,
150152
105
@@ -220,10 +222,13 @@ protected function _construct()
220222
);
221223
}
222224
}
223-
Event.observe(window, \'load\', function(){
224-
Event.observe($("select_stores"), \'change\', review.updateRating);
225-
});
226225
';
226+
if (!$this->_storeManager->hasSingleStore()) {
227+
$this->_formInitScripts[] = 'Event.observe(window, \'load\', function(){
228+
Event.observe($("select_stores"), \'change\', review.updateRating);
229+
});
230+
';
231+
}
227232
}
228233

229234
/**

0 commit comments

Comments
 (0)