当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Core_Model_Layout::addBlock方法代码示例

本文整理汇总了PHP中Mage_Core_Model_Layout::addBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Layout::addBlock方法的具体用法?PHP Mage_Core_Model_Layout::addBlock怎么用?PHP Mage_Core_Model_Layout::addBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Core_Model_Layout的用法示例。


在下文中一共展示了Mage_Core_Model_Layout::addBlock方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testSetListCollection

 public function testSetListCollection()
 {
     $childBlock = $this->_layout->addBlock('Mage_Core_Block_Text', 'search_result_list', 'block');
     $this->assertEmpty($childBlock->getCollection());
     $this->_block->setListCollection();
     $this->assertInstanceOf('Mage_CatalogSearch_Model_Resource_Advanced_Collection', $childBlock->getCollection());
 }
开发者ID:nemphys,项目名称:magento2,代码行数:7,代码来源:ResultTest.php

示例2: setUp

 protected function setUp()
 {
     $this->_layoutMock = Mage::getModel('Mage_Core_Model_Layout');
     $this->_block = new Mage_Backend_Block_Widget_Grid_Extended(array('layout' => $this->_layoutMock));
     $this->_layoutMock->addBlock($this->_block, 'grid');
     $this->_block->addColumn('column1', array('id' => 'columnId1'));
     $this->_block->addColumn('column2', array('id' => 'columnId2'));
 }
开发者ID:nayanchamp,项目名称:magento2,代码行数:8,代码来源:ExtendedTest.php

示例3: setUp

 protected function setUp()
 {
     $this->_objectManager = Mage::getObjectManager();
     $this->_layout = $this->_objectManager->get('Mage_Core_Model_Layout');
     $this->_blockFactory = $this->_objectManager->get('Mage_Core_Model_BlockFactory');
     $this->_block = $this->_blockFactory->createBlock('Mage_Webapi_Block_Adminhtml_User_Edit_Tab_Main');
     $this->_layout->addBlock($this->_block);
 }
开发者ID:,项目名称:,代码行数:8,代码来源:

示例4: testGetColumns

 public function testGetColumns()
 {
     $layout = new Mage_Core_Model_Layout();
     $block = $layout->addBlock('Mage_Wishlist_Block_Customer_Wishlist_Items', 'test');
     $child = $this->getMock('Mage_Core_Block_Text', array('isEnabled'));
     $child->expects($this->any())->method('isEnabled')->will($this->returnValue(true));
     $layout->addBlock($child, 'child', 'test');
     $this->assertSame(array($child), $block->getColumns());
 }
开发者ID:nemphys,项目名称:magento2,代码行数:9,代码来源:ItemsTest.php

示例5: testSetListOrders

 public function testSetListOrders()
 {
     $layout = new Mage_Core_Model_Layout();
     $layout->addBlock('Mage_Core_Block_Text', 'head');
     // The tested block is using head block
     $block = $layout->addBlock('Mage_CatalogSearch_Block_Result', 'block');
     $childBlock = $layout->addBlock('Mage_Core_Block_Text', 'search_result_list', 'block');
     $this->assertSame($childBlock, $block->getListBlock());
 }
开发者ID:nemphys,项目名称:magento2,代码行数:9,代码来源:ResultTest.php

示例6: testGetMode

 public function testGetMode()
 {
     $layout = new Mage_Core_Model_Layout();
     $layout->addBlock($this->_block, 'test');
     $expected = uniqid();
     $toolbar = new Mage_Core_Block_Text(array('current_mode' => $expected));
     $layout->addBlock($toolbar, 'toolbar', 'test');
     $this->assertEquals($expected, $this->_block->getMode());
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:9,代码来源:View.php

示例7: performUploadButtonTest

 /**
  * Reuse code for testing getUploadButtonHtml()
  *
  * @param Mage_Core_Block_Abstract $block
  */
 public static function performUploadButtonTest(Mage_Core_Block_Abstract $block)
 {
     $layout = new Mage_Core_Model_Layout();
     $layout->addBlock($block, 'links');
     $expected = uniqid();
     $text = new Mage_Core_Block_Text(array('text' => $expected));
     $layout->addBlock($text, 'upload_button', 'links');
     self::assertEquals($expected, $block->getUploadButtonHtml());
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:14,代码来源:Links.php

示例8: setUp

 protected function setUp()
 {
     $this->_block = new Mage_Tag_Block_Product_Result();
     $this->_layout = new Mage_Core_Model_Layout();
     $this->_layout->addBlock('Mage_Core_Block_Text', 'root');
     $this->_layout->addBlock('Mage_Core_Block_Text', 'head');
     $this->_layout->addBlock($this->_block, 'test');
     $this->_child = new Mage_Core_Block_Text();
     $this->_layout->addBlock($this->_child, 'search_result_list', 'test');
 }
开发者ID:nemphys,项目名称:magento2,代码行数:10,代码来源:ResultTest.php

示例9: testSetLayout

 public function testSetLayout()
 {
     $layout = new Mage_Core_Model_Layout();
     $headBlock = new Mage_Core_Block_Template();
     $layout->addBlock($headBlock, 'head');
     $layout->addBlock($this->_block);
     $this->assertNotEmpty($headBlock->getTitle());
     $this->assertEquals($this->_product->getMetaTitle(), $headBlock->getTitle());
     $this->assertEquals($this->_product->getMetaKeyword(), $headBlock->getKeywords());
     $this->assertEquals($this->_product->getMetaDescription(), $headBlock->getDescription());
 }
开发者ID:nemphys,项目名称:magento2,代码行数:11,代码来源:ViewTest.php

示例10: testGetFormHtml

 public function testGetFormHtml()
 {
     $layout = new Mage_Core_Model_Layout();
     // Create block with blocking _prepateLayout(), which is used by block to instantly add 'form' child
     $block = $this->getMock('Mage_Adminhtml_Block_Widget_Form_Container', array('_prepareLayout'));
     $layout->addBlock($block, 'block');
     $form = $layout->addBlock('Mage_Core_Block_Text', 'form', 'block');
     $expectedHtml = '<b>html</b>';
     $this->assertNotEquals($expectedHtml, $block->getFormHtml());
     $form->setText($expectedHtml);
     $this->assertEquals($expectedHtml, $block->getFormHtml());
 }
开发者ID:nemphys,项目名称:magento2,代码行数:12,代码来源:ContainerTest.php

示例11: testToHtmlFormId

 public function testToHtmlFormId()
 {
     $layout = new Mage_Core_Model_Layout();
     $block = $layout->addBlock('Mage_Adminhtml_Block_Catalog_Product_Attribute_Set_Toolbar_Add', 'block');
     $block->setArea('adminhtml');
     $childBlock = $layout->addBlock('Mage_Core_Block_Template', 'setForm', 'block');
     $form = new Varien_Object();
     $childBlock->setForm($form);
     $expectedId = '12121212';
     $this->assertNotContains($expectedId, $block->toHtml());
     $form->setId($expectedId);
     $this->assertContains($expectedId, $block->toHtml());
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:13,代码来源:Add.php

示例12: testGetItemExtraInfoHtml

 public function testGetItemExtraInfoHtml()
 {
     $layout = new Mage_Core_Model_Layout();
     $block = $this->getMockForAbstractClass('Mage_Adminhtml_Block_Sales_Items_Abstract');
     $layout->addBlock($block, 'block');
     $item = new Varien_Object();
     $this->assertEmpty($block->getItemExtraInfoHtml($item));
     $expectedHtml = '<html><body>some data</body></html>';
     $childBlock = $layout->addBlock('Mage_Core_Block_Text', 'other_block', 'block', 'order_item_extra_info');
     $childBlock->setText($expectedHtml);
     $this->assertEquals($expectedHtml, $block->getItemExtraInfoHtml($item));
     $this->assertSame($item, $childBlock->getItem());
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:13,代码来源:AbstractTest.php

示例13: testToHtmlWithContainer

 public function testToHtmlWithContainer()
 {
     $listName = $this->_block->getNameInLayout();
     $block1 = $this->_layout->addBlock('Mage_Core_Block_Text', '', $listName);
     $this->_layout->addContainer('container', 'Container', array(), $listName);
     $block2 = $this->_layout->addBlock('Mage_Core_Block_Text', '', 'container');
     $block3 = $this->_layout->addBlock('Mage_Core_Block_Text', '', $listName);
     $block1->setText('text1');
     $block2->setText('text2');
     $block3->setText('text3');
     $html = $this->_block->toHtml();
     $this->assertEquals('text1text2text3', $html);
 }
开发者ID:nemphys,项目名称:magento2,代码行数:13,代码来源:ListTest.php

示例14: testGetInvoiceCommentsHtml

 public function testGetInvoiceCommentsHtml()
 {
     $childBlock = $this->_layout->addBlock('Mage_Core_Block_Text', 'invoice_comments', 'block');
     $expectedHtml = '<b>Any html</b>';
     $this->assertEmpty($childBlock->getEntity());
     $this->assertEmpty($childBlock->getTitle());
     $this->assertNotEquals($expectedHtml, $this->_block->getInvoiceCommentsHtml($this->_invoice));
     $childBlock->setText($expectedHtml);
     $actualHtml = $this->_block->getInvoiceCommentsHtml($this->_invoice);
     $this->assertSame($this->_invoice, $childBlock->getEntity());
     $this->assertNotEmpty($childBlock->getTitle());
     $this->assertEquals($expectedHtml, $actualHtml);
 }
开发者ID:nemphys,项目名称:magento2,代码行数:13,代码来源:ItemsTest.php

示例15: testToHtmlPropagatesUrl

 public function testToHtmlPropagatesUrl()
 {
     $this->_block->setShouldPrepareInfoTabs(true);
     $childOne = $this->_layout->addBlock('Mage_Core_Block_Text', 'child1', 'block');
     $this->_layout->addToParentGroup('child1', 'info_tabs');
     $childTwo = $this->_layout->addBlock('Mage_Core_Block_Text', 'child2', 'block');
     $this->_layout->addToParentGroup('child2', 'info_tabs');
     $this->assertEmpty($childOne->getViewUrl());
     $this->assertEmpty($childTwo->getViewUrl());
     $this->_block->toHtml();
     $this->assertNotEmpty($childOne->getViewUrl());
     $this->assertNotEmpty($childTwo->getViewUrl());
 }
开发者ID:,项目名称:,代码行数:13,代码来源:


注:本文中的Mage_Core_Model_Layout::addBlock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。