Pop\Form\Form::addFields PHP Method

addFields() public method

Alias for setFields()
public addFields ( array $fields ) : Form
$fields array
return Form
    public function addFields(array $fields)
    {
        $this->setFields($fields);
    }

Usage Example

Example #1
0
 public function testRemoveArrayOfElements()
 {
     $fields = array(array('username' => array('type' => 'text', 'value' => 'Username here...', 'label' => 'Username:'******'required' => true, 'attributes' => array('size' => 40))), array('email1' => array('type' => 'text', 'label' => 'Email 1:', 'required' => true, 'attributes' => array('size' => 40)), 'email2' => array('type' => 'text', 'label' => 'Email 1:', 'required' => true, 'attributes' => array('size' => 40))));
     $f = new Form('/submit', 'post');
     $f->addFields($fields);
     $f->removeElement('username');
     $this->assertEquals(2, count($f->getFields()));
 }