Pop\Form\Form::filter PHP Method

filter() public method

Method to filter current form values with the applied callbacks and their parameters
public filter ( array $filters ) : Form
$filters array
return Form
    public function filter($filters)
    {
        $this->setFieldValues($this->fields, $filters);
        return $this;
    }

Usage Example

Example #1
0
 public function testFilter()
 {
     $fields = array('username' => array('type' => 'text', 'value' => 'Username here...', 'label' => 'Username:'******'required' => true, 'attributes' => array('size' => 40)));
     $f = new Form('/submit', 'post', $fields);
     $f->setFieldValues(array('username' => '<p>te\'st"<script>user</script></p>'), array('strip_tags' => '<p>', 'htmlentities' => array(ENT_QUOTES, 'UTF-8')));
     $this->assertEquals('&lt;p&gt;te&#039;st&quot;user&lt;/p&gt;', $f->username);
     $f->filter(array('html_entity_decode' => array(ENT_QUOTES, 'UTF-8')));
     $this->assertEquals('<p>te\'st"user</p>', $f->username);
 }
All Usage Examples Of Pop\Form\Form::filter