Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Link.php
Go to the documentation of this file.
1 <?php
11 
17 {
21  protected $wishlistHelper;
22 
26  protected $rssUrlBuilder;
27 
31  protected $urlEncoder;
32 
40  public function __construct(
41  \Magento\Framework\View\Element\Template\Context $context,
42  \Magento\Wishlist\Helper\Data $wishlistHelper,
43  \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder,
44  \Magento\Framework\Url\EncoderInterface $urlEncoder,
45  array $data = []
46  ) {
47  parent::__construct($context, $data);
48  $this->wishlistHelper = $wishlistHelper;
49  $this->rssUrlBuilder = $rssUrlBuilder;
50  $this->urlEncoder = $urlEncoder;
51  }
52 
56  public function getLink()
57  {
58  return $this->rssUrlBuilder->getUrl($this->getLinkParams());
59  }
60 
66  public function isRssAllowed()
67  {
68  return $this->_scopeConfig->isSetFlag(
69  'rss/wishlist/active',
70  \Magento\Store\Model\ScopeInterface::SCOPE_STORE
71  );
72  }
73 
77  protected function getLinkParams()
78  {
79  $params = [];
80  $wishlistId = $this->wishlistHelper->getWishlist()->getId();
81  $customer = $this->wishlistHelper->getCustomer();
82  if ($customer) {
83  $key = $customer->getId() . ',' . $customer->getEmail();
84  $params = [
85  'type' => 'wishlist',
86  'data' => $this->urlEncoder->encode($key),
87  '_secure' => false
88  ];
89  }
90  if ($wishlistId) {
91  $params['wishlist_id'] = $wishlistId;
92  }
93  return $params;
94  }
95 }
$customer
Definition: customers.php:11
return false
Definition: gallery.phtml:36
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
Definition: website.php:18