/** * Retrieve layout updates by handle * * @param string $handle * @param \Magento\Framework\View\Design\ThemeInterface $theme * @param \Magento\Framework\App\ScopeInterface $store * @return string */ public function fetchUpdatesByHandle($handle, \Magento\Framework\View\Design\ThemeInterface $theme, \Magento\Framework\App\ScopeInterface $store) { $bind = ['layout_update_handle' => $handle, 'theme_id' => $theme->getId(), 'store_id' => $store->getId()]; $result = ''; $connection = $this->getConnection(); if ($connection) { $select = $this->_getFetchUpdatesByHandleSelect(); $result = join('', $connection->fetchCol($select, $bind)); } return $result; }
/** * Retrieve layout updates by handle * * @param string $handle * @param \Magento\Framework\View\Design\ThemeInterface $theme * @param \Magento\Framework\App\ScopeInterface $store * @return string */ public function fetchUpdatesByHandle($handle, \Magento\Framework\View\Design\ThemeInterface $theme, \Magento\Framework\App\ScopeInterface $store) { $bind = ['theme_id' => $theme->getId(), 'store_id' => $store->getId()]; $cacheKey = implode('-', $bind); if (!isset($this->layoutUpdateCache[$cacheKey])) { $this->layoutUpdateCache[$cacheKey] = []; foreach ($this->getConnection()->fetchAll($this->_getFetchUpdatesByHandleSelect(), $bind) as $layout) { if (!isset($this->layoutUpdateCache[$cacheKey][$layout['handle']])) { $this->layoutUpdateCache[$cacheKey][$layout['handle']] = ''; } $this->layoutUpdateCache[$cacheKey][$layout['handle']] .= $layout['xml']; } } return isset($this->layoutUpdateCache[$cacheKey][$handle]) ? $this->layoutUpdateCache[$cacheKey][$handle] : ''; }