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 $eventManager;
24 
28  protected $messageSession;
29 
35  public function __construct(
37  \Magento\Framework\Event\Manager $eventManager,
38  \Magento\Framework\Message\Session $messageSession
39  ) {
40  $this->depersonalizeChecker = $depersonalizeChecker;
41  $this->eventManager = $eventManager;
42  $this->messageSession = $messageSession;
43  }
44 
52  public function afterGenerateXml(\Magento\Framework\View\LayoutInterface $subject, $result)
53  {
54  if ($this->depersonalizeChecker->checkIfDepersonalize($subject)) {
55  $this->eventManager->dispatch('depersonalize_clear_session');
56  session_write_close();
57  $this->messageSession->clearStorage();
58  }
59  return $result;
60  }
61 }
afterGenerateXml(\Magento\Framework\View\LayoutInterface $subject, $result)
__construct(DepersonalizeChecker $depersonalizeChecker, \Magento\Framework\Event\Manager $eventManager, \Magento\Framework\Message\Session $messageSession)