/** * generates the original block * * @param Sitewards_BigPipe_Block_Node $sourceBlock * @return Mage_Core_Block_Abstract */ private function generateBlock(Sitewards_BigPipe_Block_Node $sourceBlock) { /* @var $node SimpleXMLElement */ $node = $sourceBlock->getOriginalNode(); $layout = Mage::app()->getLayout(); $nodeName = $sourceBlock->getNodeName(); $layout->replaceBlock($node, $sourceBlock->getParent()); return $layout->getBlock($nodeName); }
/** * compare by bigpipe-order attribute * * @param Sitewards_BigPipe_Block_Node $a * @param Sitewards_BigPipe_Block_Node $b * @return int */ private function compareByBigPipeOrder(Sitewards_BigPipe_Block_Node $a, Sitewards_BigPipe_Block_Node $b) { $aOrder = (int) $a->getOriginalNode()->attributes()->{'bigpipe-order'}; $bOrder = (int) $b->getOriginalNode()->attributes()->{'bigpipe-order'}; if ($aOrder == $bOrder) { return 0; } return $aOrder < $bOrder ? -1 : 1; }