12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- /**
- * Depersonalize catalog session data
- *
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Catalog\Model\Layout;
- use Magento\PageCache\Model\DepersonalizeChecker;
- /**
- * Class DepersonalizePlugin
- */
- class DepersonalizePlugin
- {
- /**
- * @var DepersonalizeChecker
- */
- protected $depersonalizeChecker;
- /**
- * Catalog session
- *
- * @var \Magento\Catalog\Model\Session
- */
- protected $catalogSession;
- /**
- * @param DepersonalizeChecker $depersonalizeChecker
- * @param \Magento\Catalog\Model\Session $catalogSession
- */
- public function __construct(
- DepersonalizeChecker $depersonalizeChecker,
- \Magento\Catalog\Model\Session $catalogSession
- ) {
- $this->catalogSession = $catalogSession;
- $this->depersonalizeChecker = $depersonalizeChecker;
- }
- /**
- * After generate Xml
- *
- * @param \Magento\Framework\View\LayoutInterface $subject
- * @param \Magento\Framework\View\LayoutInterface $result
- * @return \Magento\Framework\View\LayoutInterface
- */
- public function afterGenerateXml(\Magento\Framework\View\LayoutInterface $subject, $result)
- {
- if ($this->depersonalizeChecker->checkIfDepersonalize($subject)) {
- $this->catalogSession->clearStorage();
- }
- return $result;
- }
- }
|