示例#1
0
 /**
  * Replace the output of the block, containing ttl attribute, with ESI tag
  *
  * @param \Magento\Framework\View\Element\AbstractBlock $block
  * @return string
  */
 protected function _wrapEsi(\Magento\Framework\View\Element\AbstractBlock $block)
 {
     $url = $block->getUrl('page_cache/block/esi', array('blocks' => json_encode(array($block->getNameInLayout())), 'handles' => json_encode($this->_helper->getActualHandles())));
     return sprintf('<esi:include src="%s" />', $url);
 }
示例#2
0
 /**
  * Retrieve script options encoded to json
  *
  * @return string
  */
 public function getScriptOptions()
 {
     $params = array('url' => $this->getUrl('page_cache/block/render/'), 'handles' => $this->helper->getActualHandles(), 'versionCookieName' => \Magento\Framework\App\PageCache\Version::COOKIE_NAME);
     return json_encode($params);
 }