本文整理匯總了PHP中Magento\Framework\Data\Form::getFieldsetElementRenderer方法的典型用法代碼示例。如果您正苦於以下問題:PHP Form::getFieldsetElementRenderer方法的具體用法?PHP Form::getFieldsetElementRenderer怎麽用?PHP Form::getFieldsetElementRenderer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Framework\Data\Form
的用法示例。
在下文中一共展示了Form::getFieldsetElementRenderer方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testSettersGetters
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]');
}
示例2: addField
/**
* Add field to fieldset
*
* @param string $elementId
* @param string $type
* @param array $config
* @param bool $after
* @param bool $isAdvanced
* @return AbstractElement
*/
public function addField($elementId, $type, $config, $after = false, $isAdvanced = false)
{
$element = parent::addField($elementId, $type, $config, $after);
if ($renderer = Form::getFieldsetElementRenderer()) {
$element->setRenderer($renderer);
}
$element->setAdvanced($isAdvanced);
return $element;
}