-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Fix For Issue:Incorrect redirect navigate on the review edit page #29318 #30436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2.4-develop
Are you sure you want to change the base?
Changes from 3 commits
440a4cf
206335f
0a81ed8
c3f6365
2ded1c1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,26 @@ | |
*/ | ||
class BackButton extends GenericButton implements ButtonProviderInterface | ||
{ | ||
/** | ||
* @var Form | ||
*/ | ||
private $form; | ||
/** | ||
* @var \Magento\Framework\Url\DecoderInterface | ||
*/ | ||
private $decoder; | ||
|
||
public function __construct( | ||
\Magento\Framework\Url\DecoderInterface $decoder, | ||
\Magento\Customer\Block\Adminhtml\Edit\Form $form, | ||
\Magento\Backend\Block\Widget\Context $context, | ||
\Magento\Framework\Registry $registry | ||
) { | ||
parent::__construct($context, $registry); | ||
$this->form = $form; | ||
$this->decoder = $decoder; | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
|
@@ -32,6 +52,12 @@ public function getButtonData() | |
*/ | ||
public function getBackUrl() | ||
{ | ||
if ($fromPath=$this->decoder->decode($this->form->getRequest()->getParam('fromPath'))) { | ||
return $this->getUrl( | ||
$fromPath, | ||
['id' => $this->form->getRequest()->getParam('review_id')] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe we need a universal solution for similar cases instead of fixing particular places. We see the same situation when we go to the customer information page from the order view page. So, we may have a couple more places in the admin panel where we have the same issue with the back button. It would be great if we could find out how to solve this issue for all occurrences. Hope it makes sense There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hello, @rogyar! I've done some investigation and I don't see the possibility to make a universal and reasonable solution for all "Back" buttons. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @engcom-Foxtrot. I've been reflected on that for some time and you are right. It's not an easy task unless we have the same name for an entity identifier. Anyway, thank you for checking! |
||
); | ||
} | ||
return $this->getUrl('*/*/'); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding this parameter from the request, can't we use the
RedirectInterface
and the methodgetRefererUrl
? This should return the URL that the request came from.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gabrieldagama I don't think it's a good idea. This will cause redirect to any previously opened page and works as the 'back' button in the browser.