Link.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Multishipping\Block\Checkout;
  7. /**
  8. * Multishipping cart link
  9. *
  10. * @api
  11. * @since 100.0.2
  12. */
  13. class Link extends \Magento\Framework\View\Element\Template
  14. {
  15. /**
  16. * Multishipping helper
  17. *
  18. * @var \Magento\Multishipping\Helper\Data
  19. */
  20. protected $helper;
  21. /**
  22. * @param \Magento\Framework\View\Element\Template\Context $context
  23. * @param \Magento\Multishipping\Helper\Data $helper
  24. * @param array $data
  25. */
  26. public function __construct(
  27. \Magento\Framework\View\Element\Template\Context $context,
  28. \Magento\Multishipping\Helper\Data $helper,
  29. array $data = []
  30. ) {
  31. $this->helper = $helper;
  32. parent::__construct($context, $data);
  33. $this->_isScopePrivate = true;
  34. }
  35. /**
  36. * @return string
  37. */
  38. public function getCheckoutUrl()
  39. {
  40. return $this->getUrl('multishipping/checkout', ['_secure' => true]);
  41. }
  42. /**
  43. * @return \Magento\Quote\Model\Quote
  44. */
  45. public function getQuote()
  46. {
  47. return $this->helper->getQuote();
  48. }
  49. /**
  50. * @return string
  51. */
  52. public function _toHtml()
  53. {
  54. if (!$this->helper->isMultishippingCheckoutAvailable()) {
  55. return '';
  56. }
  57. return parent::_toHtml();
  58. }
  59. }