Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Wishlist.php
Go to the documentation of this file.
1 <?php
13 
19 {
25  protected $_customer = null;
26 
31 
38  public function __construct(
39  \Magento\Catalog\Block\Product\Context $context,
40  \Magento\Framework\App\Http\Context $httpContext,
41  \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository,
42  array $data = []
43  ) {
44  $this->customerRepository = $customerRepository;
45  parent::__construct(
46  $context,
48  $data
49  );
50  }
51 
58  protected function _prepareLayout()
59  {
60  parent::_prepareLayout();
61  $this->pageConfig->getTitle()->set($this->getHeader());
62  return $this;
63  }
64 
70  public function getWishlistCustomer()
71  {
72  if ($this->_customer === null) {
73  $this->_customer = $this->customerRepository->getById($this->_getWishlist()->getCustomerId());
74  }
75 
76  return $this->_customer;
77  }
78 
84  public function getHeader()
85  {
86  return __("%1's Wish List", $this->escapeHtml($this->getWishlistCustomer()->getFirstname()));
87  }
88 }
__()
Definition: __.php:13
__construct(\Magento\Catalog\Block\Product\Context $context, \Magento\Framework\App\Http\Context $httpContext, \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository, array $data=[])
Definition: Wishlist.php:38