orderFactory = $orderFactory; $this->rssUrlBuilder = $rssUrlBuilder; parent::__construct($context, $data); } /** * Get link url. * * @return string */ public function getLink() { return $this->rssUrlBuilder->getUrl($this->getLinkParams()); } /** * Get translatable label for url. * * @return \Magento\Framework\Phrase */ public function getLabel() { return __('Subscribe to Order Status'); } /** * Check whether status notification is allowed * * @return bool */ public function isRssAllowed() { return $this->_scopeConfig->isSetFlag( 'rss/order/status', \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); } /** * Retrieve order status url key * * @param \Magento\Sales\Model\Order $order * @return string */ protected function getUrlKey($order) { $data = [ 'order_id' => $order->getId(), 'increment_id' => $order->getIncrementId(), 'customer_id' => $order->getCustomerId(), ]; return base64_encode(json_encode($data)); } /** * Get type, secure and query params for link. * * @return array * @SuppressWarnings(PHPMD.RequestAwareBlockMethod) */ protected function getLinkParams() { $order = $this->orderFactory->create()->load($this->_request->getParam('order_id')); return [ 'type' => 'order_status', '_secure' => true, '_query' => ['data' => $this->getUrlKey($order)] ]; } }