本文整理汇总了PHP中Magento\Framework\View\LayoutInterface::isCacheable方法的典型用法代码示例。如果您正苦于以下问题:PHP LayoutInterface::isCacheable方法的具体用法?PHP LayoutInterface::isCacheable怎么用?PHP LayoutInterface::isCacheable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\View\LayoutInterface
的用法示例。
在下文中一共展示了LayoutInterface::isCacheable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterGenerateXml
/**
* 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->moduleManager->isEnabled('Magento_PageCache') && $this->cacheConfig->isEnabled() && !$this->request->isAjax() && $subject->isCacheable()) {
$this->checkoutSession->clearStorage();
}
return $result;
}
示例2: getCustomer
/**
* Returns current customer according to session and context
*
* @return \Magento\Customer\Service\V1\Data\Customer
*/
public function getCustomer()
{
if ($this->moduleManager->isEnabled('Magento_PageCache') && !$this->request->isAjax() && $this->view->isLayoutLoaded() && $this->layout->isCacheable()) {
return $this->getDepersonalizedCustomer();
} else {
return $this->getCustomerFromService();
}
}
示例3: checkIfDepersonalize
/**
* Check if depersonalize or not
*
* @param \Magento\Framework\View\LayoutInterface $subject
* @return bool
* @api
*/
public function checkIfDepersonalize(\Magento\Framework\View\LayoutInterface $subject)
{
return $this->moduleManager->isEnabled('Magento_PageCache') && $this->cacheConfig->isEnabled() && !$this->request->isAjax() && ($this->request->isGet() || $this->request->isHead()) && $subject->isCacheable();
}
示例4: __construct
/**
* Constructor
*
* @param LayoutFactory $layoutFactory
* @param LayoutInterface $generalLayout
*/
public function __construct(LayoutFactory $layoutFactory, \Magento\Framework\View\LayoutInterface $generalLayout)
{
$this->layout = $layoutFactory->create(['cacheable' => $generalLayout->isCacheable()]);
}
示例5: afterGenerateXml
/**
* 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->moduleManager->isEnabled('Magento_PageCache') && $this->cacheConfig->isEnabled() && !$this->request->isAjax() && $subject->isCacheable()) {
$this->visitor->setSkipRequestLogging(true);
$this->visitor->unsetData();
$this->session->clearStorage();
$this->customerSession->clearStorage();
$this->session->setData(\Magento\Framework\Data\Form\FormKey::FORM_KEY, $this->formKey);
$this->customerSession->setCustomerGroupId($this->customerGroupId);
$this->customer->setGroupId($this->customerGroupId);
$this->customerSession->setCustomer($this->customer);
}
return $result;
}