Exemplo n.º 1
0
 /**
  * Preparing global layout
  *
  * You can redefine this method in child classes for changing layout
  *
  * @return $this
  */
 protected function _prepareLayout()
 {
     \Magento\Framework\Data\Form::setElementRenderer($this->getLayout()->createBlock('Magento\\Backend\\Block\\Widget\\Form\\Renderer\\Element', $this->getNameInLayout() . '_element'));
     \Magento\Framework\Data\Form::setFieldsetRenderer($this->getLayout()->createBlock('Magento\\Backend\\Block\\Widget\\Form\\Renderer\\Fieldset', $this->getNameInLayout() . '_fieldset'));
     \Magento\Framework\Data\Form::setFieldsetElementRenderer($this->getLayout()->createBlock('Magento\\Backend\\Block\\Widget\\Form\\Renderer\\Fieldset\\Element', $this->getNameInLayout() . '_fieldset_element'));
     return parent::_prepareLayout();
 }
Exemplo n.º 2
0
 public function testSettersGetters()
 {
     $setElementRenderer = $this->getMockBuilder('Magento\\Backend\\Block\\Widget\\Form\\Renderer\\Element')->disableOriginalConstructor()->getMock();
     // note: this results in setting a static variable in the Form class
     $this->_form->setElementRenderer($setElementRenderer);
     $getElementRenderer = $this->_form->getElementRenderer();
     $this->assertSame($setElementRenderer, $getElementRenderer);
     // restore our Form to its earlier state
     $this->_form->setElementRenderer(null);
     $setFieldsetRenderer = $this->getMockBuilder('Magento\\Backend\\Block\\Widget\\Form\\Renderer\\Fieldset')->disableOriginalConstructor()->getMock();
     $this->_form->setFieldsetRenderer($setFieldsetRenderer);
     $getFieldsetRenderer = $this->_form->getFieldsetRenderer();
     $this->assertSame($setFieldsetRenderer, $getFieldsetRenderer);
     $setFieldsetElementRenderer = $this->getMockBuilder('Magento\\Backend\\Block\\Widget\\Form\\Renderer\\Fieldset')->disableOriginalConstructor()->getMock();
     $this->_form->setFieldsetElementRenderer($setFieldsetElementRenderer);
     $getFieldsetElementRenderer = $this->_form->getFieldsetElementRenderer();
     $this->assertSame($setFieldsetElementRenderer, $getFieldsetElementRenderer);
     $this->assertSame($this->_form->getHtmlAttributes(), ['id', 'name', 'method', 'action', 'enctype', 'class', 'onsubmit', 'target']);
     $this->_form->setFieldContainerIdPrefix('abc');
     $this->assertSame($this->_form->getFieldContainerIdPrefix(), 'abc');
     $result = $this->_form->addSuffixToName('123', 'abc');
     $this->assertSame($result, 'abc[123]');
 }
Exemplo n.º 3
0
 /**
  * Reset application global state
  */
 protected function _resetApp()
 {
     /** @var $objectManager \Magento\TestFramework\ObjectManager */
     $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
     $objectManager->clearCache();
     \Magento\Framework\Data\Form::setElementRenderer(null);
     \Magento\Framework\Data\Form::setFieldsetRenderer(null);
     \Magento\Framework\Data\Form::setFieldsetElementRenderer(null);
     $this->_appArea = null;
 }
Exemplo n.º 4
0
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     \Magento\Framework\Data\Form::setFieldsetElementRenderer($this->createBlock('Magento\\Form\\Renderer\\Element'));
     \Magento\Framework\Data\Form::setFieldsetRenderer($this->createBlock('Magento\\Form\\Renderer\\Fieldset'));
 }
Exemplo n.º 5
0
 /**
  * prepare layout.
  *
  * @return $this
  */
 protected function _prepareLayout()
 {
     $this->getLayout()->getBlock('page.title')->setPageTitle($this->getPageTitle());
     \Magento\Framework\Data\Form::setFieldsetElementRenderer($this->getLayout()->createBlock('Magestore\\Bannerslider\\Block\\Adminhtml\\Form\\Renderer\\Fieldset\\Element', $this->getNameInLayout() . '_fieldset_element'));
     return $this;
 }