36 protected $_template =
'Magento_GiftMessage::inline.phtml';
77 \
Magento\Customer\Model\Session $customerSession,
84 $this->_giftMessageMessage = $giftMessageMessage;
85 $this->_customerSession = $customerSession;
86 parent::__construct($context,
$data);
87 $this->_isScopePrivate =
true;
124 $this->_type =
$type;
148 $this->checkoutType =
$type;
170 return $this->
getEntity()->getGiftMessageId() > 0;
180 $this->_giftMessage = $this->_giftMessageMessage->getGiftMessage($this->
getEntity()->getGiftMessageId());
192 return $this->_customerSession->getCustomer()->getName();
194 return $this->
getEntity()->getBillingAddress()->getName();
205 if ($this->
getEntity()->getShippingAddress()) {
206 return $this->
getEntity()->getShippingAddress()->getName();
220 if ($this->_giftMessage ===
null) {
225 if (!
$entity->getGiftMessage()) {
226 $entity->setGiftMessage($this->_giftMessageMessage->getGiftMessage(
$entity->getGiftMessageId()));
228 return $entity->getGiftMessage();
241 if (!$this->
getData(
'items')) {
244 $entityItems = $this->
getEntity()->getAllItems();
245 $this->_eventManager->dispatch(
'gift_options_prepare_items', [
'items' => $entityItems]);
247 foreach ($entityItems as
$item) {
248 if (
$item->getParentItem()) {
257 return $this->
getData(
'items');
267 return count($this->
getItems()) > 0;
298 if (
$item->getGiftMessageId()) {
313 return $this->
getEntity()->getGiftMessageId() > 0;
335 return $this->_giftMessageMessage->isMessagesAllowed(
'quote', $this->
getEntity());
346 $type = substr($this->
getType(), 0, 5) ==
'multi' ?
'address_item' :
'item';
347 return $this->_giftMessageMessage->isMessagesAllowed(
$type,
$item);
359 return parent::_toHtml();
getData($key='', $index=null)
getImage($product, $imageId, $attributes=[])
isItemMessagesAvailable($item)
getEscaped($value, $defaultValue='')
escapeHtml($data, $allowedTags=null)
__construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Customer\Model\Session $customerSession, \Magento\GiftMessage\Helper\Message $giftMessageMessage, \Magento\Catalog\Block\Product\ImageBuilder $imageBuilder, \Magento\Framework\App\Http\Context $httpContext, array $data=[])
setData($key, $value=null)