本文整理汇总了PHP中Magento\Framework\Data\Form::addValues方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::addValues方法的具体用法?PHP Form::addValues怎么用?PHP Form::addValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Data\Form
的用法示例。
在下文中一共展示了Form::addValues方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAddValue
public function testAddValue()
{
$this->_factoryCollectionMock->expects($this->once())->method('create')->will($this->returnValue($this->allElementsMock));
$this->_form = new Form($this->_factoryElementMock, $this->_factoryCollectionMock, $this->_formKeyMock);
$values = ['element_id' => 'value_one'];
$this->elementMock->expects($this->once())->method('getId')->will($this->returnValue('element_id'));
$this->allElementsMock->expects($this->once())->method('add')->with($this->elementMock);
$this->elementMock->expects($this->once())->method('setValue')->with('value_one');
$this->_form->addElementToCollection($this->elementMock);
$this->_form->addValues($values);
}
示例2: addValues
/**
* @param array $values
* @return $this
*/
public function addValues($values)
{
if (!is_array($values)) {
return $this;
}
$values = array_merge($values, $this->getAdditionalData($values));
if (isset($values['frontend_input']) && 'select' == $values['frontend_input'] && isset($values[Swatch::SWATCH_INPUT_TYPE_KEY])) {
$values['frontend_input'] = 'swatch_' . $values[Swatch::SWATCH_INPUT_TYPE_KEY];
}
return parent::addValues($values);
}
示例3: testElementOperations
public function testElementOperations()
{
$buttonElement = $this->getMockBuilder('Magento\\Framework\\Data\\Form\\Element\\Button')->disableOriginalConstructor()->getMock();
$buttonElement->expects($this->any())->method('getId')->will($this->returnValue('1'));
$buttonElement->expects($this->any())->method('getName')->will($this->returnValue('Hero'));
$this->_form->addElement($buttonElement);
$this->_form->addElementToCollection($buttonElement);
$this->_form->addValues(['1', '2', '3']);
$this->_form->setValues(['4', '5', '6']);
$this->_form->addFieldNameSuffix('abc123');
$this->_form->removeField($buttonElement->getId());
$this->assertSame($this->_form->checkElementId($buttonElement->getId()), true);
}