69 private $_storeManager;
85 \
Magento\Framework\View\LayoutFactory $layoutFactory,
86 \
Magento\GiftMessage\Model\MessageFactory $giftMessageFactory,
87 \
Magento\Framework\Escaper $escaper,
90 $this->_escaper = $escaper;
92 $this->_layoutFactory = $layoutFactory;
93 $this->_giftMessageFactory = $giftMessageFactory;
115 return $this->_layoutFactory->create()->createBlock(\
Magento\GiftMessage\Block\
Message\Inline::class)
116 ->setId(
'giftmessage_form_' . $this->_nextId++)
117 ->setDontDisplayContainer($dontDisplayContainer)
119 ->setCheckoutType(
$type)->toHtml();
128 return in_array($pageType, $this->skipMessageCheck);
142 if (
$type ==
'items') {
145 return $this->scopeConfig->getValue(
146 self::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ITEMS,
147 \
Magento\Store\Model\ScopeInterface::SCOPE_STORE,
152 $_type =
$entity->getIsMultiShipping() ?
'address_item' :
'item';
154 $_type =
'order_item';
157 if (
$item->getParentItem()) {
170 if (!$this->
isCached(
'address_item_' . $entity->getProductId())) {
172 $giftMessageAvailable = $this->productRepository->getById(
$entity->getProductId(),
false,
$storeId)
173 ->getGiftMessageAvailable();
174 }
catch (\
Magento\Framework\Exception\NoSuchEntityException $noEntityException) {
175 $giftMessageAvailable =
null;
177 $this->
setCached(
'address_item_' . $entity->getProductId(), $giftMessageAvailable);
180 $this->
getCached(
'address_item_' . $entity->getProductId()),
184 return $this->scopeConfig->getValue(
185 self::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ORDER,
186 \
Magento\Store\Model\ScopeInterface::SCOPE_STORE,
202 $result = $this->scopeConfig->getValue(
203 self::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ITEMS,
204 \
Magento\Store\Model\ScopeInterface::SCOPE_STORE,
210 return $productConfig;
224 return nl2br($this->_escaper->escapeHtml(
$message->getMessage()));
241 return $entity->getGiftMessage();
255 return $this->_innerCache[$key];
268 return isset($this->_innerCache[$key]);
280 $this->_innerCache[$key] =
$value;
328 $message = $this->_giftMessageFactory->create();
329 if ($messageId !==
null) {
elseif(isset( $params[ 'redirect_parent']))
getEscapedGiftMessage(\Magento\Framework\DataObject $entity)
const XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ORDER
const XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ITEMS
getGiftMessage($messageId=null)
isMessagesAllowed($type, \Magento\Framework\DataObject $entity, $store=null)
_getDependenceFromStoreConfig($productConfig, $store=null)
__construct(\Magento\Framework\App\Helper\Context $context, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Api\ProductRepositoryInterface $productRepository, \Magento\Framework\View\LayoutFactory $layoutFactory, \Magento\GiftMessage\Model\MessageFactory $giftMessageFactory, \Magento\Framework\Escaper $escaper, $skipMessageCheck=[])
getInline($type, \Magento\Framework\DataObject $entity, $dontDisplayContainer=false)
getGiftMessageForEntity(\Magento\Framework\DataObject $entity)
getAvailableForQuoteItems($quote, $store=null)
getAvailableForAddressItems($items, $store=null)