Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ConfigProviderPlugin.php
Go to the documentation of this file.
1 <?php
7 
8 use Magento\Persistent\Helper\Session as PersistentSession;
9 use Magento\Persistent\Helper\Data as PersistentHelper;
11 use Magento\Quote\Model\QuoteIdMaskFactory;
13 
15 {
19  private $persistentSession;
20 
24  private $persistentHelper;
25 
29  private $checkoutSession;
30 
34  private $quoteIdMaskFactory;
35 
39  private $customerSession;
40 
48  public function __construct(
49  PersistentHelper $persistentHelper,
50  PersistentSession $persistentSession,
51  CheckoutSession $checkoutSession,
52  QuoteIdMaskFactory $quoteIdMaskFactory,
53  CustomerSession $customerSession
54  ) {
55  $this->persistentHelper = $persistentHelper;
56  $this->persistentSession = $persistentSession;
57  $this->checkoutSession = $checkoutSession;
58  $this->quoteIdMaskFactory = $quoteIdMaskFactory;
59  $this->customerSession = $customerSession;
60  }
61 
68  public function afterGetConfig(\Magento\Checkout\Model\DefaultConfigProvider $subject, array $result)
69  {
70  if ($this->persistentHelper->isEnabled()
71  && $this->persistentSession->isPersistent()
72  && !$this->customerSession->isLoggedIn()
73  ) {
75  $quoteIdMask = $this->quoteIdMaskFactory->create();
76  $result['quoteData']['entity_id'] = $quoteIdMask->load(
77  $this->checkoutSession->getQuote()->getId(),
78  'quote_id'
79  )->getMaskedId();
80  }
81  return $result;
82  }
83 }
$persistentSession
Definition: persistent.php:11
__construct(PersistentHelper $persistentHelper, PersistentSession $persistentSession, CheckoutSession $checkoutSession, QuoteIdMaskFactory $quoteIdMaskFactory, CustomerSession $customerSession)