Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-page-cache
Model
Layout
LayoutPlugin.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\PageCache\Model\Layout
;
7
11
class
LayoutPlugin
12
{
16
protected
$config
;
17
21
protected
$response
;
22
29
public
function
__construct
(
30
\
Magento
\Framework\
App
\ResponseInterface
$response
,
31
\
Magento
\PageCache\Model\
Config
$config
32
) {
33
$this->response =
$response
;
34
$this->config =
$config
;
35
}
36
45
public
function
afterGenerateXml
(\
Magento
\Framework\View\Layout $subject,
$result
)
46
{
47
if
($subject->isCacheable() && $this->config->isEnabled()) {
48
$this->response->setPublicHeaders($this->config->getTtl());
49
}
50
return
$result
;
51
}
52
60
public
function
afterGetOutput
(\
Magento
\Framework\View\Layout $subject,
$result
)
61
{
62
if
($subject->isCacheable() && $this->config->isEnabled()) {
63
$tags = [];
64
foreach
($subject->getAllBlocks() as
$block
) {
65
if
(
$block
instanceof \
Magento
\Framework\DataObject\IdentityInterface) {
66
$isEsiBlock =
$block
->getTtl() > 0;
67
$isVarnish = $this->config->getType() ==
\Magento\PageCache\Model\Config::VARNISH
;
68
if
($isVarnish && $isEsiBlock) {
69
continue
;
70
}
71
$tags = array_merge($tags,
$block
->getIdentities());
72
}
73
}
74
$tags = array_unique($tags);
75
$this->response->setHeader(
'X-Magento-Tags'
, implode(
','
, $tags));
76
}
77
return
$result
;
78
}
79
}
$result
$result
Definition:
product_configurable_not_available_rollback.php:26
Magento\PageCache\Model\Layout
Definition:
MergeTest.php:6
Magento\PageCache\Model\Config\VARNISH
const VARNISH
Definition:
Config.php:28
Magento\Framework\App
$block
$block
Definition:
block.php:8
Magento\PageCache\Model\Layout\LayoutPlugin\$config
$config
Definition:
LayoutPlugin.php:16
Magento\PageCache\Model\Config
Definition:
Config.php:21
Magento\PageCache\Model\Layout\LayoutPlugin\afterGetOutput
afterGetOutput(\Magento\Framework\View\Layout $subject, $result)
Definition:
LayoutPlugin.php:60
Magento
Magento\PageCache\Model\Layout\LayoutPlugin\$response
$response
Definition:
LayoutPlugin.php:21
Magento\PageCache\Model\Layout\LayoutPlugin
Definition:
LayoutPlugin.php:11
Magento\PageCache\Model\Layout\LayoutPlugin\afterGenerateXml
afterGenerateXml(\Magento\Framework\View\Layout $subject, $result)
Definition:
LayoutPlugin.php:45
Magento\PageCache\Model\Layout\LayoutPlugin\__construct
__construct(\Magento\Framework\App\ResponseInterface $response, \Magento\PageCache\Model\Config $config)
Definition:
LayoutPlugin.php:29