Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Rss.php
Go to the documentation of this file.
1 <?php
7 
15 {
19  protected $_template = 'Magento_Sales::order/info/buttons/rss.phtml';
20 
24  protected $orderFactory;
25 
29  protected $rssUrlBuilder;
30 
37  public function __construct(
38  \Magento\Framework\View\Element\Template\Context $context,
39  \Magento\Sales\Model\OrderFactory $orderFactory,
40  \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder,
41  array $data = []
42  ) {
43  $this->orderFactory = $orderFactory;
44  $this->rssUrlBuilder = $rssUrlBuilder;
45  parent::__construct($context, $data);
46  }
47 
51  public function getLink()
52  {
53  return $this->rssUrlBuilder->getUrl($this->getLinkParams());
54  }
55 
59  public function getLabel()
60  {
61  return __('Subscribe to Order Status');
62  }
63 
69  public function isRssAllowed()
70  {
71  return $this->_scopeConfig->isSetFlag(
72  'rss/order/status',
74  );
75  }
76 
83  protected function getUrlKey($order)
84  {
85  $data = [
86  'order_id' => $order->getId(),
87  'increment_id' => $order->getIncrementId(),
88  'customer_id' => $order->getCustomerId(),
89  ];
90  return base64_encode(json_encode($data));
91  }
92 
96  protected function getLinkParams()
97  {
98  $order = $this->orderFactory->create()->load($this->_request->getParam('order_id'));
99  return [
100  'type' => 'order_status',
101  '_secure' => true,
102  '_query' => ['data' => $this->getUrlKey($order)]
103  ];
104  }
105 }
__construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder, array $data=[])
Definition: Rss.php:37
$order
Definition: order.php:55
__()
Definition: __.php:13