/** * Create placeholder object based on block information * * @param Mage_Core_Block_Abstract $block * @return Enterprise_PageCache_Model_Container_Placeholder */ public function getBlockPlaceholder($block) { $this->_initPlaceholders(); $type = $block->getType(); if (isset($this->_placeholders[$type])) { $placeholderData = false; foreach ($this->_placeholders[$type] as $placeholderInfo) { if (!empty($placeholderInfo['name'])) { if ($placeholderInfo['name'] == $block->getNameInLayout()) { $placeholderData = $placeholderInfo; } } else { $placeholderData = $placeholderInfo; } } if (!$placeholderData) { return false; } $placeholder = $placeholderData['code'] . ' container="' . $placeholderData['container'] . '"' . ' block="' . get_class($block) . '"'; $placeholder .= ' cache_id="' . $block->getCacheKey() . '"'; foreach ($block->getCacheKeyInfo() as $k => $v) { if (is_string($k) && !empty($k)) { $placeholder .= ' ' . $k . '="' . $v . '"'; } } $placeholder = Mage::getModel('enterprise_pagecache/container_placeholder', $placeholder); return $placeholder; } return false; }
/** * Remove last block from context * * @param Mage_Core_Block_Abstract $block */ public function unregisterContext(Mage_Core_Block_Abstract $block) { if (in_array($block->getType(), array_keys($this->_config->getDeclaredPlaceholders()))) { array_pop($this->_context); } }