zendframework/zf2 — pull request #1508 by weierophinney (2012-06-15 19:25:33+00:00)
Title: Feature/form annotation builder

This PR implements the final major feature of the Forms RFC: annotation support.

This support is completely opt-in, and leverages the various factories created in Zend\Form and Zend\InputFilter. Internally, it creates a number of annotation classes that are used to populate a specification for a form and its elements, as well as the related input filter. Current operations include:

* Setting the name of the form or individual elements
* Setting a specific class to use for a form, individual elements, the form's input filter, or an element's related input
* Setting a form's hydrator, attributes, and flags
* Setting an element's attributes, flags, and its related input's filters, validators, and behavior metadata

Annotations are processed within event loops. As such, you can process custom or third party annotations by simply adding additional listeners to the events ("discoverName", "configureForm", and "configureElement"); check for the annotation type, and modify one or more of the event parameters.

Examples are currently included in the unit tests, under the Zend/Form/TestAsset/Annotation directory; I'll be writing docs in a separate pull request.