zendframework/zf2 — pull request #3932 by stephanoff (2013-03-01 21:18:39+00:00)
Title: Added form abstract factory

Added form abstract form factory to provide form configuration with specification defined in configuration file. Registered *form* section in configuration file.
```php
array(
'form' => array(
'Frontend\Form\Authentication' => array(
'name' => 'authentication',
'attributes' => array(
'action' => '/path/to/controller',
'method' => 'POST',
),
'elements' => array(
array(
'spec' => array(
'name' => 'username',
'attributes' => array(
'type' => 'text',
),
'options' => array(
'label' => 'Username',
),
),
),
array(
'spec' => array(
'name' => 'password',
'attributes' => array(
'type' => 'password',
),
'options' => array(
'label' => 'Password',
),
),
),
array(
'spec' => array(
'name' => 'submit',
'attributes' => array(
'type' => 'submit',
),
'options' => array(
'label' => 'Sign in',
),
)
),
),
'input_filter' => array(
array(
'name' => 'username',
'required' => true,
'filters' => array(
array(
'name' => 'StringTrim'
)
),
'validators' => array(
array(
'name' => 'RegEx',
'options' => array(
'pattern' => '/^[a-zA-Z][a-zA-Z0-9]+_[a-zA-Z][a-zA-Z0-9]+$/',
'messages' => array(
'regexNotMatch' => 'Username is incorrect',
)
)
),
)
),
array(
'name' => 'password',
'required' => true,
'filters' => array(
array(
'name' => 'StringTrim'
)
)
)
)
)
)
)
```