SwitcherPlugin.php 879 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Paypal\Block\Adminhtml\Store;
  7. use Magento\Backend\Block\Store\Switcher as StoreSwitcherBlock;
  8. use Magento\Paypal\Model\Config\StructurePlugin as ConfigStructurePlugin;
  9. /**
  10. * Plugin for \Magento\Backend\Block\Store\Switcher
  11. */
  12. class SwitcherPlugin
  13. {
  14. /**
  15. * Remove country request param from url
  16. *
  17. * @param StoreSwitcherBlock $subject
  18. * @param string $route
  19. * @param array $params
  20. * @return array
  21. */
  22. public function beforeGetUrl(StoreSwitcherBlock $subject, $route = '', $params = [])
  23. {
  24. if ($subject->getRequest()->getParam(ConfigStructurePlugin::REQUEST_PARAM_COUNTRY)) {
  25. $params[ConfigStructurePlugin::REQUEST_PARAM_COUNTRY] = null;
  26. }
  27. return [$route, $params];
  28. }
  29. }