• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP View\LayoutInterface类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Magento\Framework\View\LayoutInterface的典型用法代码示例。如果您正苦于以下问题:PHP LayoutInterface类的具体用法?PHP LayoutInterface怎么用?PHP LayoutInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: afterGenerateXml

 /**
  * After generate Xml
  *
  * @param \Magento\Framework\View\LayoutInterface $subject
  * @param \Magento\Framework\View\LayoutInterface $result
  * @return \Magento\Framework\View\LayoutInterface
  */
 public function afterGenerateXml(\Magento\Framework\View\LayoutInterface $subject, $result)
 {
     if ($this->moduleManager->isEnabled('Magento_PageCache') && $this->cacheConfig->isEnabled() && !$this->request->isAjax() && $subject->isCacheable()) {
         $this->checkoutSession->clearStorage();
     }
     return $result;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:14,代码来源:DepersonalizePlugin.php


示例2: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->_layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\View\\LayoutInterface');
     $this->_theme = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Framework\\View\\Design\\ThemeInterface');
     $this->_theme->setType(\Magento\Framework\View\Design\ThemeInterface::TYPE_VIRTUAL);
     $this->_block = $this->_layout->createBlock('Magento\\Theme\\Block\\Adminhtml\\System\\Design\\Theme\\Edit\\Tab\\General');
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:8,代码来源:GeneralTest.php


示例3: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->_layoutMock = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\View\\LayoutInterface');
     $context = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Backend\\Block\\Template\\Context', ['layout' => $this->_layoutMock]);
     $this->_block = $this->_layoutMock->createBlock('Magento\\Backend\\Block\\Widget\\Grid\\Extended', 'grid', ['context' => $context]);
     $this->_block->addColumn('column1', ['id' => 'columnId1']);
     $this->_block->addColumn('column2', ['id' => 'columnId2']);
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:9,代码来源:ExtendedTest.php


示例4: setUp

 protected function setUp()
 {
     $this->_layoutMock = $this->getMock('Magento\\Framework\\View\\Layout', [], [], '', false);
     $this->_columnSetMock = $this->_getColumnSetMock();
     $returnValueMap = [['grid', 'grid.columnSet', 'grid.columnSet'], ['grid', 'reset_filter_button', 'reset_filter_button'], ['grid', 'search_button', 'search_button']];
     $this->_layoutMock->expects($this->any())->method('getChildName')->will($this->returnValueMap($returnValueMap));
     $this->_layoutMock->expects($this->any())->method('getBlock')->with('grid.columnSet')->will($this->returnValue($this->_columnSetMock));
     $this->_layoutMock->expects($this->any())->method('createBlock')->with('Magento\\Backend\\Block\\Widget\\Button')->will($this->returnValue(\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\View\\LayoutInterface')->createBlock('Magento\\Backend\\Block\\Widget\\Button')));
     $this->_layoutMock->expects($this->any())->method('helper')->with('Magento\\Framework\\Json\\Helper\\Data')->will($this->returnValue(\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\Json\\Helper\\Data')));
     $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\View\\LayoutInterface')->createBlock('Magento\\Backend\\Block\\Widget\\Grid');
     $this->_block->setLayout($this->_layoutMock);
     $this->_block->setNameInLayout('grid');
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:13,代码来源:GridTest.php


示例5: getAfterElementHtml

    /**
     * Retrieve additional html and put it at the end of element html
     *
     * @return string
     */
    public function getAfterElementHtml()
    {
        $html = parent::getAfterElementHtml();
        if ($this->getIsWysiwygEnabled()) {
            $disabled = $this->getDisabled() || $this->getReadonly();
            $html .= $this->_layout->createBlock('Magento\\Backend\\Block\\Widget\\Button', '', array('data' => array('label' => __('WYSIWYG Editor'), 'type' => 'button', 'disabled' => $disabled, 'class' => $disabled ? 'disabled action-wysiwyg' : 'action-wysiwyg', 'onclick' => 'catalogWysiwygEditor.open(\'' . $this->_backendData->getUrl('catalog/product/wysiwyg') . '\', \'' . $this->getHtmlId() . '\')')))->toHtml();
            $html .= <<<HTML
<script type="text/javascript">
jQuery('#{$this->getHtmlId()}')
    .addClass('wysiwyg-editor')
    .data(
        'wysiwygEditor',
        new tinyMceWysiwygSetup(
            '{$this->getHtmlId()}',
             {
                settings: {
                    theme_advanced_buttons1 : 'bold,italic,|,justifyleft,justifycenter,justifyright,|,' +
                        'fontselect,fontsizeselect,|,forecolor,backcolor,|,link,unlink,image,|,bullist,numlist,|,code',
                    theme_advanced_buttons2: null,
                    theme_advanced_buttons3: null,
                    theme_advanced_buttons4: null,
                    theme_advanced_statusbar_location: null
                }
            }
        ).turnOn()
    );
</script>
HTML;
        }
        return $html;
    }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:36,代码来源:Wysiwyg.php


示例6: testPrepareElementHtml

 /**
  * @covers \Magento\Cms\Block\Adminhtml\Block\Widget\Chooser::prepareElementHtml
  * @param string $elementValue
  * @param integer|null $modelBlockId
  *
  * @dataProvider prepareElementHtmlDataProvider
  */
 public function testPrepareElementHtml($elementValue, $modelBlockId)
 {
     $elementId = 1;
     $uniqId = '126hj4h3j73hk7b347jhkl37gb34';
     $sourceUrl = 'cms/block_widget/chooser/126hj4h3j73hk7b347jhkl37gb34';
     $config = ['key1' => 'value1'];
     $fieldsetId = 2;
     $html = 'some html';
     $title = 'some title';
     $this->this->setConfig($config);
     $this->this->setFieldsetId($fieldsetId);
     $this->elementMock->expects($this->atLeastOnce())->method('getId')->willReturn($elementId);
     $this->mathRandomMock->expects($this->atLeastOnce())->method('getUniqueHash')->with($elementId)->willReturn($uniqId);
     $this->urlBuilderMock->expects($this->atLeastOnce())->method('getUrl')->with('cms/block_widget/chooser', ['uniq_id' => $uniqId])->willReturn($sourceUrl);
     $this->layoutMock->expects($this->atLeastOnce())->method('createBlock')->with('Magento\\Widget\\Block\\Adminhtml\\Widget\\Chooser')->willReturn($this->chooserMock);
     $this->chooserMock->expects($this->atLeastOnce())->method('setElement')->with($this->elementMock)->willReturnSelf();
     $this->chooserMock->expects($this->atLeastOnce())->method('setConfig')->with($config)->willReturnSelf();
     $this->chooserMock->expects($this->atLeastOnce())->method('setFieldsetId')->with($fieldsetId)->willReturnSelf();
     $this->chooserMock->expects($this->atLeastOnce())->method('setSourceUrl')->with($sourceUrl)->willReturnSelf();
     $this->chooserMock->expects($this->atLeastOnce())->method('setUniqId')->with($uniqId)->willReturnSelf();
     $this->elementMock->expects($this->atLeastOnce())->method('getValue')->willReturn($elementValue);
     $this->blockFactoryMock->expects($this->any())->method('create')->willReturn($this->modelBlockMock);
     $this->modelBlockMock->expects($this->any())->method('load')->with($elementValue)->willReturnSelf();
     $this->modelBlockMock->expects($this->any())->method('getId')->willReturn($modelBlockId);
     $this->modelBlockMock->expects($this->any())->method('getTitle')->willReturn($title);
     $this->chooserMock->expects($this->any())->method('setLabel')->with($title)->willReturnSelf();
     $this->chooserMock->expects($this->atLeastOnce())->method('toHtml')->willReturn($html);
     $this->elementMock->expects($this->atLeastOnce())->method('setData')->with('after_element_html', $html)->willReturnSelf();
     $this->assertEquals($this->elementMock, $this->this->prepareElementHtml($this->elementMock));
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:37,代码来源:ChooserTest.php


示例7: testGetBlock

 public function testGetBlock()
 {
     $blockName = 'block.name';
     $block = $this->getMock('Magento\\Framework\\View\\Element\\BlockInterface');
     $this->layout->expects($this->once())->method('getBlock')->with($blockName)->will($this->returnValue($block));
     $this->assertEquals($block, $this->model->getBlock($blockName));
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:7,代码来源:LayoutTest.php


示例8: testSetListCollection

 public function testSetListCollection()
 {
     /** @var $childBlock \Magento\Framework\View\Element\Text */
     $childBlock = $this->_layout->addBlock('Magento\\Framework\\View\\Element\\Text', 'search_result_list', 'block');
     $this->assertEmpty($childBlock->getCollection());
     $this->_block->setListCollection();
     $this->assertInstanceOf('Magento\\CatalogSearch\\Model\\ResourceModel\\Advanced\\Collection', $childBlock->getCollection());
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:8,代码来源:ResultTest.php


示例9: testGetGridHtml

 public function testGetGridHtml()
 {
     $html = '<body></body>';
     $this->layoutMock->expects($this->any())->method('getChildName')->willReturn('userGrid');
     $this->layoutMock->expects($this->any())->method('renderElement')->willReturn($html);
     $this->model->setLayout($this->layoutMock);
     $this->assertEquals($html, $this->model->getGridHtml());
 }
开发者ID:hientruong90,项目名称:magento2_installer,代码行数:8,代码来源:UsersTest.php


示例10: testAddBreadcrumbNoBlock

 public function testAddBreadcrumbNoBlock()
 {
     $label = 'label';
     $title = 'title';
     $this->layoutMock->expects($this->once())->method('getBlock')->with('breadcrumbs')->willReturn(false);
     $this->breadcrumbsBlockMock->expects($this->never())->method('addLink');
     $this->assertSame($this->resultPage, $this->resultPage->addBreadcrumb($label, $title));
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:8,代码来源:PageTest.php


示例11: aroundRender

 /**
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  * @param \Magento\LayeredNavigation\Block\Navigation\FilterRenderer $subject
  * @param \Closure $proceed
  * @param \Magento\Catalog\Model\Layer\Filter\FilterInterface $filter
  * @return mixed
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function aroundRender(\Magento\LayeredNavigation\Block\Navigation\FilterRenderer $subject, \Closure $proceed, \Magento\Catalog\Model\Layer\Filter\FilterInterface $filter)
 {
     if ($filter->hasAttributeModel()) {
         if ($this->swatchHelper->isSwatchAttribute($filter->getAttributeModel())) {
             return $this->layout->createBlock($this->block)->setSwatchFilter($filter)->toHtml();
         }
     }
     return $proceed($filter);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:17,代码来源:FilterRenderer.php


示例12: create

 /**
  * Get renderer for element
  *
  * @param string $elementClassName
  * @param string $rendererName
  * @return RendererInterface
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public function create($elementClassName, $rendererName)
 {
     if (!isset($this->_rendererByElement[$elementClassName])) {
         throw new \Magento\Framework\Exception\LocalizedException(__('No renderer registered for elements of class "%1"', $elementClassName));
     }
     $rendererClass = $this->_rendererByElement[$elementClassName];
     $renderer = $this->_layout->createBlock($rendererClass, $rendererName);
     return $renderer;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:17,代码来源:Factory.php


示例13: execute

 /**
  * Adds Google Experiment tab to the category edit page
  *
  * @param EventObserver $observer
  * @return void
  */
 public function execute(EventObserver $observer)
 {
     if ($this->_helper->isGoogleExperimentActive()) {
         $block = $this->_layout->createBlock('Magento\\GoogleOptimizer\\Block\\Adminhtml\\Catalog\\Category\\Edit\\Tab\\Googleoptimizer', 'google-experiment-form');
         /** @var $tabs \Magento\Catalog\Block\Adminhtml\Category\Tabs */
         $tabs = $observer->getEvent()->getTabs();
         $tabs->addTab('google-experiment-tab', ['label' => __('Category View Optimization'), 'content' => $block->toHtml()]);
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:15,代码来源:AddGoogleExperimentTabObserver.php


示例14: getContentHtml

 /**
  * Prepares content block
  *
  * @return string
  */
 public function getContentHtml()
 {
     /* @var $content \Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Gallery\Content */
     $content = $this->_layout->createBlock('Magento\\Catalog\\Block\\Adminhtml\\Product\\Helper\\Form\\Gallery\\Content');
     $content->setId($this->getHtmlId() . '_content')->setElement($this);
     $galleryJs = $content->getJsObjectName();
     $content->getUploader()->getConfig()->setMegiaGallery($galleryJs);
     return $content->toHtml();
 }
开发者ID:aiesh,项目名称:magento2,代码行数:14,代码来源:Gallery.php


示例15: testPrepareLayoutSuccessOnFalseGetId

 public function testPrepareLayoutSuccessOnFalseGetId()
 {
     $tab = 'tab';
     $this->registryMock->expects($this->once())->method('registry')->willReturn($this->layoutInterfaceMock);
     $this->layoutInterfaceMock->expects($this->any())->method('createBlock')->willReturnSelf();
     $this->layoutInterfaceMock->expects($this->once())->method('setRole')->willReturnSelf();
     $this->layoutInterfaceMock->expects($this->once())->method('setActive')->willReturn($tab);
     $this->layoutInterfaceMock->expects($this->once())->method('getId')->willReturn(false);
     $this->assertInstanceOf('Magento\\Backend\\Block\\Widget\\Tabs', $this->invokeMethod($this->model, '_prepareLayout'));
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:10,代码来源:EditTest.php


示例16: testGetRenderer

 public function testGetRenderer()
 {
     $this->blockMock->expects($this->any())->method('setRenderedBlock')->will($this->returnValue($this->blockMock));
     $this->blockMock->expects($this->any())->method('getTemplate')->will($this->returnValue('template'));
     $this->blockMock->expects($this->any())->method('setTemplate')->will($this->returnValue($this->blockMock));
     $this->layoutMock->expects($this->any())->method('getChildName')->will($this->returnValue(true));
     /** During the first call cache will be generated */
     $this->assertInstanceOf('\\Magento\\Framework\\View\\Element\\BlockInterface', $this->renderList->getRenderer('type', null, null));
     /** Cached value should be returned during second call */
     $this->assertInstanceOf('\\Magento\\Framework\\View\\Element\\BlockInterface', $this->renderList->getRenderer('type', null, 'renderer_template'));
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:11,代码来源:RendererListTest.php


示例17: setGoogleAnalyticsOnOrderSuccessPageView

 /**
  * Add order information into GA block to render on checkout success pages
  *
  * @param EventObserver $observer
  * @return void
  */
 public function setGoogleAnalyticsOnOrderSuccessPageView(EventObserver $observer)
 {
     $orderIds = $observer->getEvent()->getOrderIds();
     if (empty($orderIds) || !is_array($orderIds)) {
         return;
     }
     $block = $this->_layout->getBlock('google_analytics');
     if ($block) {
         $block->setOrderIds($orderIds);
     }
 }
开发者ID:aiesh,项目名称:magento2,代码行数:17,代码来源:Observer.php


示例18: execute

 /**
  * Add order information into GA block to render on checkout success pages
  *
  * @param EventObserver $observer
  * @return void
  */
 public function execute(EventObserver $observer)
 {
     $orderIds = $observer->getEvent()->getOrderIds();
     if (empty($orderIds) || !is_array($orderIds)) {
         return;
     }
     $block = $this->_layout->getBlock('magepal_gtm_datalayer');
     if ($block) {
         $block->setOrderIds($orderIds);
     }
 }
开发者ID:magepal,项目名称:magento2-googletagmanager,代码行数:17,代码来源:OrderSuccessPageViewObserver.php


示例19: testAfterToHtml

 /**
  * @covers \Magento\Sales\Block\Adminhtml\Report\Filter\Form\Coupon::_afterToHtml
  */
 public function testAfterToHtml()
 {
     /** @var $block \Magento\Sales\Block\Adminhtml\Report\Filter\Form\Coupon */
     $block = $this->_layout->createBlock('Magento\\Sales\\Block\\Adminhtml\\Report\\Filter\\Form\\Coupon');
     $block->setFilterData(new \Magento\Framework\DataObject());
     $html = $block->toHtml();
     $expectedStrings = ['FormElementDependenceController', 'sales_report_rules_list', 'sales_report_price_rule_type'];
     foreach ($expectedStrings as $expectedString) {
         $this->assertContains($expectedString, $html);
     }
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:14,代码来源:CouponTest.php


示例20: testGetCustomerDepersonalizeCustomerData

 /**
  * test getCustomer method, method returns depersonalized customer Data
  */
 public function testGetCustomerDepersonalizeCustomerData()
 {
     $this->requestMock->expects($this->once())->method('isAjax')->will($this->returnValue(false));
     $this->layoutMock->expects($this->once())->method('isCacheable')->will($this->returnValue(true));
     $this->viewMock->expects($this->once())->method('isLayoutLoaded')->will($this->returnValue(true));
     $this->moduleManagerMock->expects($this->once())->method('isEnabled')->with($this->equalTo('Magento_PageCache'))->will($this->returnValue(true));
     $this->customerSessionMock->expects($this->once())->method('getCustomerGroupId')->will($this->returnValue($this->customerGroupId));
     $this->customerInterfaceFactoryMock->expects($this->once())->method('create')->will($this->returnValue($this->customerDataMock));
     $this->customerDataMock->expects($this->once())->method('setGroupId')->with($this->equalTo($this->customerGroupId))->will($this->returnSelf());
     $this->assertEquals($this->customerDataMock, $this->currentCustomer->getCustomer());
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:14,代码来源:CurrentCustomerTest.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Asset\Repository类代码示例发布时间:2022-05-23
下一篇:
PHP View\LayoutFactory类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap