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


PHP View\LayoutInterface类代码示例

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


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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: 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


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