forked from magento/magento2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWishlist.php
More file actions
85 lines (77 loc) · 2.03 KB
/
Wishlist.php
File metadata and controls
85 lines (77 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* Wishlist block shared items
*/
namespace Magento\Wishlist\Block\Share;
/**
* @api
* @since 100.0.2
*/
class Wishlist extends \Magento\Wishlist\Block\AbstractBlock
{
/**
* Customer instance
*
* @var \Magento\Customer\Api\Data\CustomerInterface
*/
protected $_customer = null;
/**
* @var \Magento\Customer\Api\CustomerRepositoryInterface
*/
protected $customerRepository;
/**
* @param \Magento\Catalog\Block\Product\Context $context
* @param \Magento\Framework\App\Http\Context $httpContext
* @param \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository
* @param array $data
*/
public function __construct(
\Magento\Catalog\Block\Product\Context $context,
\Magento\Framework\App\Http\Context $httpContext,
\Magento\Customer\Api\CustomerRepositoryInterface $customerRepository,
array $data = []
) {
$this->customerRepository = $customerRepository;
parent::__construct(
$context,
$httpContext,
$data
);
}
/**
* Prepare global layout
*
* @return $this
*/
protected function _prepareLayout()
{
parent::_prepareLayout();
$this->pageConfig->getTitle()->set($this->getHeader());
return $this;
}
/**
* Retrieve Shared Wishlist Customer instance
*
* @return \Magento\Customer\Api\Data\CustomerInterface
*/
public function getWishlistCustomer()
{
if ($this->_customer === null) {
$this->_customer = $this->customerRepository->getById($this->_getWishlist()->getCustomerId());
}
return $this->_customer;
}
/**
* Retrieve Page Header
*
* @return \Magento\Framework\Phrase
*/
public function getHeader()
{
return __("%1's Wish List", $this->escapeHtml($this->getWishlistCustomer()->getFirstname()));
}
}