OrderUrl.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. /**
  3. * Refer to LICENSE.txt distributed with the Temando Shipping module for notice of license
  4. */
  5. namespace Temando\Shipping\ViewModel\DataProvider;
  6. use Magento\Framework\UrlInterface;
  7. /**
  8. * Order URL provider
  9. *
  10. * @package Temando\Shipping\ViewModel
  11. * @author Christoph Aßmann <christoph.assmann@netresearch.de>
  12. * @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
  13. * @link https://www.temando.com/
  14. */
  15. class OrderUrl implements EntityUrlInterface
  16. {
  17. /**
  18. * @var UrlInterface
  19. */
  20. private $urlBuilder;
  21. /**
  22. * OrderUrl constructor.
  23. * @param UrlInterface $urlBuilder
  24. */
  25. public function __construct(UrlInterface $urlBuilder)
  26. {
  27. $this->urlBuilder = $urlBuilder;
  28. }
  29. /**
  30. * @return string
  31. */
  32. public function getNewActionUrl(): string
  33. {
  34. return $this->urlBuilder->getUrl('sales/order_create/start');
  35. }
  36. /**
  37. * @return string
  38. */
  39. public function getListActionUrl(): string
  40. {
  41. return $this->urlBuilder->getUrl('sales/order/index');
  42. }
  43. /**
  44. * @param mixed[] $data Item data to pick entity identifier.
  45. * @return string
  46. */
  47. public function getViewActionUrl(array $data): string
  48. {
  49. return $this->urlBuilder->getUrl('sales/order/view', [
  50. 'order_id' => $data['order_id'],
  51. ]);
  52. }
  53. /**
  54. * @param mixed[] $data Item data to pick entity identifier.
  55. * @return string
  56. */
  57. public function getEditActionUrl(array $data): string
  58. {
  59. return '';
  60. }
  61. /**
  62. * @param mixed[] $data Item data for the implementer to pick entity identifier.
  63. * @return string
  64. */
  65. public function getDeleteActionUrl(array $data): string
  66. {
  67. return $this->urlBuilder->getUrl('sales/order/cancel', [
  68. 'order_id' => $data['order_id'],
  69. ]);
  70. }
  71. }