11 class Edit extends \Magento\Backend\Block\Widget\Form\Container
43 \
Magento\Review\Model\ReviewFactory $reviewFactory,
49 $this->_reviewActionPager = $reviewActionPager;
50 $this->_reviewFactory = $reviewFactory;
51 parent::__construct($context,
$data);
64 $this->_objectId =
'id';
65 $this->_blockGroup =
'Magento_Review';
66 $this->_controller =
'adminhtml';
70 $actionPager->setStorageId(
'reviews');
72 $reviewId = $this->
getRequest()->getParam(
'id');
73 $prevId = $actionPager->getPreviousItemId($reviewId);
74 $nextId = $actionPager->getNextItemId($reviewId);
75 if ($prevId !==
false) {
79 'label' =>
__(
'Previous'),
80 'onclick' =>
'setLocation(\'' . $this->
getUrl(
'review/*/*', [
'id' => $prevId]) .
'\')
' 89 'label
' => __('Save and Previous
'), 95 'target
' => '#edit_form
', 96 'eventData
' => ['action
' => ['args
' => ['next_item
' => $prevId]]], 105 if ($nextId !== false) { 109 'label
' => __('Save and Next
'), 111 'data_attribute
' => [ 115 'target
' => '#edit_form
', 116 'eventData
' => ['action
' => ['args
' => ['next_item
' => $nextId]]], 128 'label
' => __('Next
'), 129 'onclick
' => 'setLocation(\
'' . $this->
getUrl(
'review/*/*', [
'id' => $nextId]) .
'\')
' 135 $this->buttonList->update('save
', 'label
', __('Save Review
')); 136 $this->buttonList->update('save
', 'id', 'save_button
'); 137 $this->buttonList->update('delete', 'label
', __('Delete Review
')); 139 if ($this->getRequest()->getParam('productId
', false)) { 140 $this->buttonList->update( 143 'setLocation(\
'' . $this->
getUrl(
144 'catalog/product/edit',
145 [
'id' => $this->
getRequest()->getParam(
'productId',
false)]
150 if ($this->getRequest()->getParam('customerId
', false)) { 151 $this->buttonList->update( 154 'setLocation(\
'' . $this->
getUrl(
155 'customer/index/edit',
156 [
'id' => $this->
getRequest()->getParam(
'customerId',
false)]
161 if ($this->getRequest()->getParam('ret
', false) == 'pending
') { 162 $this->buttonList->update('back
', 'onclick
', 'setLocation(\
'' . $this->
getUrl(
'catalog/*/pending') .
'\')
'); 163 $this->buttonList->update( 166 'deleteConfirm(
' . '\
'' .
__(
167 'Are you sure you want to do this?' 168 ) .
'\' ' . '\
'' . $this->
getUrl(
170 [$this->_objectId => $this->
getRequest()->getParam($this->_objectId),
'ret' =>
'pending']
173 $this->_coreRegistry->register(
'ret',
'pending');
176 if ($this->
getRequest()->getParam($this->_objectId)) {
177 $reviewData = $this->_reviewFactory->create()->load($this->
getRequest()->getParam($this->_objectId));
178 $this->_coreRegistry->register(
'review_data', $reviewData);
181 $this->_formInitScripts[] =
' 183 updateRating: function() { 186 $("rating_detail").getElementsBySelector("input[type=\'radio\']") 188 $(\'save_button\').disabled = true; 193 'review/*/ratingItems',
198 parameters:Form.serializeElements(elements), 200 onComplete:function(){ $(\'save_button\').disabled = false; } 205 Event.observe(window, \'load\', function(){ 206 Event.observe($("select_stores"), \'change\', review.updateRating); 218 $reviewData = $this->_coreRegistry->registry(
'review_data');
219 if ($reviewData && $reviewData->getId()) {
220 return __(
"Edit Review '%1'", $this->
escapeHtml($reviewData->getTitle()));
222 return __(
'New Review');
if( $form)() ?>< script > require(['jquery' mage mage
escapeHtml($data, $allowedTags=null)
getUrl($route='', $params=[])
__construct(\Magento\Backend\Block\Widget\Context $context, \Magento\Review\Model\ReviewFactory $reviewFactory, \Magento\Review\Helper\Action\Pager $reviewActionPager, \Magento\Framework\Registry $registry, array $data=[])