Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ShipButton.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
14 
20 class ShipButton extends Container
21 {
25  private $registry;
26 
30  private $isWebsiteInMultiSourceMode;
31 
38  public function __construct(
39  Context $context,
40  Registry $registry,
41  IsWebsiteInMultiSourceMode $isWebsiteInMultiSourceMode,
42  array $data = []
43  ) {
44  parent::__construct($context, $data);
45  $this->registry = $registry;
46  $this->isWebsiteInMultiSourceMode = $isWebsiteInMultiSourceMode;
47  }
48 
52  protected function _prepareLayout()
53  {
54  parent::_prepareLayout();
55 
56  $order = $this->registry->registry('current_order');
57  $websiteId = (int)$order->getStore()->getWebsiteId();
58  if ($this->isWebsiteInMultiSourceMode->execute($websiteId)) {
59  $this->buttonList->update(
60  'order_ship',
61  'onclick',
62  'setLocation(\'' . $this->getSourceSelectionUrl() . '\')'
63  );
64  }
65  return $this;
66  }
67 
73  public function getSourceSelectionUrl()
74  {
75  return $this->getUrl(
76  'inventoryshipping/SourceSelection/index',
77  [
78  'order_id' => $this->getRequest()->getParam('order_id')
79  ]
80  );
81  }
82 }
$order
Definition: order.php:55
__construct(Context $context, Registry $registry, IsWebsiteInMultiSourceMode $isWebsiteInMultiSourceMode, array $data=[])
Definition: ShipButton.php:38