/** * @magentoDataFixture Mage/Cms/_files/block.php * @magentoDataFixture Mage/Core/_files/variable.php * @magentoConfigFixture current_store web/unsecure/base_url http://example.com/ * @magentoConfigFixture current_store web/unsecure/base_link_url http://example.com/ */ public function testToHtml() { $cmsBlock = new Mage_Cms_Model_Block(); $cmsBlock->load('fixture_block', 'identifier'); $block = new Mage_Cms_Block_Widget_Block(); $block->setBlockId($cmsBlock->getId()); $block->toHtml(); $result = $block->getText(); $this->assertContains('<a href="http://example.com/', $result); $this->assertContains('<p>Config value: "http://example.com/".</p>', $result); $this->assertContains('<p>Custom variable: "HTML Value".</p>', $result); }
/** * Prepare Content HTML. * * @return string */ protected function _toHtml() { if (!in_array(Mirasvit_SeoAutolink_Model_Config_Source_Target::CMS_BLOCK, $this->getConfig()->getTarget())) { return parent::_toHtml(); } $html = parent::_toHtml(); $html = Mage::helper('seoautolink')->addLinks($html); return $html; }
protected function _beforeToHtml() { $output = parent::_beforeToHtml(); $blockTags = array('p', 'div'); $content = $this->getText(); $content = preg_replace("#<\\s*\\/?(" . implode('|', $blockTags) . ")\\s*[^>]*?>#im", '', $content); $this->setText($content); return $output; }
/** * Retrieve values of properties that unambiguously identify unique content * * @return array */ public function getCacheKeyInfo() { $result = parent::getCacheKeyInfo(); $blockId = $this->getBlockId(); if ($blockId) { $result[] = $blockId; } return $result; }
/** * Collects list of objects in product list * * @param Mage_Cms_Block_Block|Mage_Cms_Block_Widget_Block $object * @return EcomDev_Varnish_Model_Proxy_Cms_Block[] */ public function collect($object) { $blockProxy = Mage::getModel('ecomdev_varnish/proxy_cms_block')->setId($object->getBlockId()); return array($blockProxy); }
protected function _toHtml() { $this->setTemplate('em_cms/widget/static_block/default.phtml'); return parent::_toHtml(); }