本文整理汇总了PHP中Mage_Core_Model_Layout::createBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Layout::createBlock方法的具体用法?PHP Mage_Core_Model_Layout::createBlock怎么用?PHP Mage_Core_Model_Layout::createBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Layout
的用法示例。
在下文中一共展示了Mage_Core_Model_Layout::createBlock方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
$this->_profile = Mage::getModel('Mage_Sales_Model_Recurring_Profile');
Mage::register('current_recurring_profile', $this->_profile);
$this->_layout = Mage::getModel('Mage_Core_Model_Layout');
$this->_block = $this->_layout->createBlock('Mage_Sales_Block_Recurring_Profile_View', 'block');
}
示例2: testGetMethodsNoChild
public function testGetMethodsNoChild()
{
$layout = new Mage_Core_Model_Layout();
$block = $layout->createBlock('Mage_Checkout_Block_Cart');
$methods = $block->getMethods('child');
$this->assertEquals(array(), $methods);
}
示例3: testGetMassactionBlock
public function testGetMassactionBlock()
{
$layout = new Mage_Core_Model_Layout();
$block = $layout->createBlock('Mage_Adminhtml_Block_Widget_Grid', 'block');
$child = $layout->addBlock('Mage_Core_Block_Template', 'massaction', 'block');
$this->assertSame($child, $block->getMassactionBlock());
}
示例4: testGetHeaderText
/**
* @param $registryData
* @param $expected
* @dataProvider getStoreDataForBlock
*/
public function testGetHeaderText($registryData, $expected)
{
$this->_initStoreTypesInRegistry($registryData);
$layout = new Mage_Core_Model_Layout();
$block = $layout->createBlock('Mage_Adminhtml_Block_System_Store_Edit', 'block');
$block->setArea(Mage_Core_Model_App_Area::AREA_ADMINHTML);
$this->assertEquals($expected, $block->getHeaderText());
}
示例5: testGetAdditionalActionBlock
public function testGetAdditionalActionBlock()
{
$layout = new Mage_Core_Model_Layout();
$block = $layout->createBlock('Mage_Adminhtml_Block_Widget_Grid_Massaction_Item', 'block');
$expected = $layout->addBlock('Mage_Core_Block_Template', 'additional_action', 'block');
$this->assertSame($expected, $block->getAdditionalActionBlock());
}
示例6: testGetGridJsObject
/**
* @magentoAppIsolation enabled
*/
public function testGetGridJsObject()
{
Mage::register('current_product', new Varien_Object());
$layout = new Mage_Core_Model_Layout();
$block = $layout->createBlock('Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Super_Config', 'block');
$this->assertEquals('super_product_linksJsObject', $block->getGridJsObject());
}
示例7: setUp
protected function setUp()
{
$customer = new Mage_Customer_Model_Customer();
$customer->load(1);
Mage::register('current_customer', $customer);
$layout = new Mage_Core_Model_Layout(array('area' => 'adminhtml'));
$this->_block = $layout->createBlock('Mage_Adminhtml_Block_Customer_Edit_Tab_View_Accordion');
}
示例8: getStaticBlock
/**
* Loads a Magento CMS static block
*
* @param string $identifier Key of CMS block
*
* @return string|boolean
*/
public static function getStaticBlock($identifier)
{
$block = self::$layout->createBlock('cms/block')->setBlockId($identifier)->toHtml();
if ($block) {
return $block;
}
return false;
}
示例9: testToHtmlFormId
public function testToHtmlFormId()
{
$layout = new Mage_Core_Model_Layout();
$block = $layout->createBlock('Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Type_Select', 'select');
$html = $block->getPriceTypeSelectHtml();
$this->assertContains('select_{{select_id}}', $html);
$this->assertContains('[{{select_id}}]', $html);
}
示例10: _getFormInstance
/**
* Get form instance
*
* @param array $args
* @return Varien_Data_Form
*/
protected function _getFormInstance($args = array())
{
$layout = new Mage_Core_Model_Layout();
/** @var $block Mage_Adminhtml_Block_Urlrewrite_Cms_Page_Edit_Form */
$block = $layout->createBlock('Mage_Adminhtml_Block_Urlrewrite_Cms_Page_Edit_Form', 'block', $args);
$block->toHtml();
return $block->getForm();
}
示例11: testPrepareLayout
/**
* Test prepare layout
*
* @dataProvider prepareLayoutDataProvider
*
* @param array $blockAttributes
* @param array $expected
*/
public function testPrepareLayout($blockAttributes, $expected)
{
$layout = new Mage_Core_Model_Layout(array('area' => Mage_Core_Model_App_Area::AREA_ADMINHTML));
/** @var $block Mage_Adminhtml_Block_Urlrewrite_Edit */
$block = $layout->createBlock('Mage_Adminhtml_Block_Urlrewrite_Edit', '', $blockAttributes);
$this->_checkSelector($block, $expected);
$this->_checkButtons($block, $expected);
$this->_checkForm($block, $expected);
}
示例12: testAddTab
/**
* @magentoAppIsolation enabled
*/
public function testAddTab()
{
$widgetInstance = new Mage_Widget_Model_Widget_Instance();
Mage::register('current_widget_instance', $widgetInstance);
$layout = new Mage_Core_Model_Layout();
$block = $layout->createBlock('Mage_Adminhtml_Block_Widget_Tabs', 'block');
$layout->addBlock('Mage_Widget_Block_Adminhtml_Widget_Instance_Edit_Tab_Main', 'child_tab', 'block');
$block->addTab('tab_id', 'child_tab');
$this->assertEquals(array('tab_id'), $block->getTabsIds());
}
示例13: testGetPagerHtml
public function testGetPagerHtml()
{
$layout = new Mage_Core_Model_Layout();
$block = $layout->createBlock('Mage_Catalog_Block_Product_List_Toolbar', 'block');
$childBlock = $layout->addBlock('Mage_Core_Block_Text', 'product_list_toolbar_pager', 'block');
$expectedHtml = '<b>Any text there</b>';
$this->assertNotEquals($expectedHtml, $block->getPagerHtml());
$childBlock->setText($expectedHtml);
$this->assertEquals($expectedHtml, $block->getPagerHtml());
}
示例14: testSetClassType
public function testSetClassType()
{
$layout = new Mage_Core_Model_Layout();
$block = $layout->createBlock('Mage_Adminhtml_Block_Tax_Class', 'block');
$childBlock = $layout->addBlock('Mage_Core_Block_Template', 'grid', 'block');
$expected = Mage_Tax_Model_Class::TAX_CLASS_TYPE_PRODUCT;
$this->assertNotEquals($expected, $childBlock->getClassType());
$block->setClassType($expected);
$this->assertEquals($expected, $childBlock->getClassType());
}
示例15: testToHtmlHasIndex
/**
* @magentoAppIsolation enabled
*/
public function testToHtmlHasIndex()
{
Mage::getDesign()->setArea(Mage_Core_Model_App_Area::AREA_ADMINHTML);
$layout = new Mage_Core_Model_Layout(array('area' => Mage_Core_Model_App_Area::AREA_ADMINHTML));
$block = $layout->createBlock('Mage_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option_Search', 'block');
$indexValue = 'magento_index_set_to_test';
$block->setIndex($indexValue);
$html = $block->toHtml();
$this->assertContains($indexValue, $html);
}