PackagingUrl.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. use Temando\Shipping\Model\PackagingInterface;
  8. /**
  9. * Packaging URL provider
  10. *
  11. * @package Temando\Shipping\ViewModel
  12. * @author Christoph Aßmann <christoph.assmann@netresearch.de>
  13. * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
  14. * @link http://www.temando.com/
  15. */
  16. class PackagingUrl implements EntityUrlInterface
  17. {
  18. /**
  19. * Url Builder
  20. *
  21. * @var UrlInterface
  22. */
  23. private $urlBuilder;
  24. /**
  25. * PackagingUrl constructor.
  26. * @param UrlInterface $urlBuilder
  27. */
  28. public function __construct(UrlInterface $urlBuilder)
  29. {
  30. $this->urlBuilder = $urlBuilder;
  31. }
  32. /**
  33. * @return string
  34. */
  35. public function getNewActionUrl(): string
  36. {
  37. return $this->urlBuilder->getUrl('temando/configuration_packaging/new');
  38. }
  39. /**
  40. * @return string
  41. */
  42. public function getListActionUrl(): string
  43. {
  44. return $this->urlBuilder->getUrl('temando/configuration_packaging/index');
  45. }
  46. /**
  47. * @param mixed[] $data Item data to pick entity identifier.
  48. * @return string
  49. */
  50. public function getViewActionUrl(array $data): string
  51. {
  52. return '';
  53. }
  54. /**
  55. * @param mixed[] $data Item data to pick entity identifier.
  56. * @return string
  57. */
  58. public function getEditActionUrl(array $data): string
  59. {
  60. return $this->urlBuilder->getUrl('temando/configuration_packaging/edit', [
  61. PackagingInterface::PACKAGING_ID => $data[PackagingInterface::PACKAGING_ID],
  62. ]);
  63. }
  64. /**
  65. * @param mixed[] $data Item data for the implementer to pick entity identifier.
  66. * @return string
  67. */
  68. public function getDeleteActionUrl(array $data): string
  69. {
  70. return $this->urlBuilder->getUrl('temando/configuration_packaging/delete', [
  71. PackagingInterface::PACKAGING_ID => $data[PackagingInterface::PACKAGING_ID]
  72. ]);
  73. }
  74. }