Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
MergePlugin.php
Go to the documentation of this file.
1 <?php
7 
9 
14 {
18  private $entitySpecificHandlesList;
19 
25  public function __construct(
26  EntitySpecificHandlesList $entitySpecificHandlesList
27  ) {
28  $this->entitySpecificHandlesList = $entitySpecificHandlesList;
29  }
30 
42  public function beforeValidateUpdate(\Magento\Framework\View\Model\Layout\Merge $subject, $handle, $updateXml)
43  {
44  if (in_array($handle, $this->entitySpecificHandlesList->getHandles())
45  && (strpos($updateXml, 'ttl=') !== false)
46  ) {
47  throw new \LogicException(
48  "Handle '{$handle}' must not contain blocks with 'ttl' attribute specified. "
49  . "Otherwise, these blocks will be treated as ESI by Varnish, however will not be shared between pages "
50  . "because handle '{$handle}' is not generic. Such blocks will not be rendered on the page"
51  );
52  }
53  return null;
54  }
55 }
beforeValidateUpdate(\Magento\Framework\View\Model\Layout\Merge $subject, $handle, $updateXml)
Definition: MergePlugin.php:42
__construct(EntitySpecificHandlesList $entitySpecificHandlesList)
Definition: MergePlugin.php:25
$handle