Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DepersonalizePlugin.php
Go to the documentation of this file.
1 <?php
7 
9 
14 {
19 
23  protected $persistentSession;
24 
31  public function __construct(
33  \Magento\Persistent\Model\Session $persistentSession
34  ) {
35  $this->persistentSession = $persistentSession;
36  $this->depersonalizeChecker = $depersonalizeChecker;
37  }
38 
46  public function afterGenerateXml(
47  \Magento\Framework\View\LayoutInterface $subject,
48  \Magento\Framework\View\LayoutInterface $result
49  ) {
50  if ($this->depersonalizeChecker->checkIfDepersonalize($subject)) {
51  $this->persistentSession->setCustomerId(null);
52  }
53 
54  return $result;
55  }
56 }
__construct(DepersonalizeChecker $depersonalizeChecker, \Magento\Persistent\Model\Session $persistentSession)
afterGenerateXml(\Magento\Framework\View\LayoutInterface $subject, \Magento\Framework\View\LayoutInterface $result)