Link.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Sales\Block\Adminhtml\Rss\Order\Grid;
  7. /**
  8. * Class Link
  9. *
  10. * @package Magento\Sales\Block\Adminhtml\Rss\Order\Grid
  11. */
  12. class Link extends \Magento\Framework\View\Element\Template
  13. {
  14. /**
  15. * @var string
  16. */
  17. protected $_template = 'Magento_Sales::rss/order/grid/link.phtml';
  18. /**
  19. * @var \Magento\Framework\App\Rss\UrlBuilderInterface
  20. */
  21. protected $rssUrlBuilder;
  22. /**
  23. * @param \Magento\Framework\View\Element\Template\Context $context
  24. * @param \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder
  25. * @param array $data
  26. */
  27. public function __construct(
  28. \Magento\Framework\View\Element\Template\Context $context,
  29. \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder,
  30. array $data = []
  31. ) {
  32. $this->rssUrlBuilder = $rssUrlBuilder;
  33. parent::__construct($context, $data);
  34. }
  35. /**
  36. * Get url for link.
  37. *
  38. * @return string
  39. */
  40. public function getLink()
  41. {
  42. return $this->rssUrlBuilder->getUrl($this->getLinkParams());
  43. }
  44. /**
  45. * Get translatable label for link.
  46. *
  47. * @return \Magento\Framework\Phrase
  48. */
  49. public function getLabel()
  50. {
  51. return __('New Order RSS');
  52. }
  53. /**
  54. * Check whether status notification is allowed
  55. *
  56. * @return bool
  57. */
  58. public function isRssAllowed()
  59. {
  60. return true;
  61. }
  62. /**
  63. * Get link type param.
  64. *
  65. * @return array
  66. */
  67. protected function getLinkParams()
  68. {
  69. return ['type' => 'new_order'];
  70. }
  71. }