zendframework/zf2 — pull request #1478 by akandels (2012-06-11 16:33:38+00:00)
Title: Form view helpers' invoke method should be chainable for options

View Helper Elements:

* Select
* Input
* Textarea
* Multicheckbox
* Element

It does not seem to be possible to set options (separator, label position, etc.) on the above form view helpers directly from the view. It can be set at a higher level, but there are cases where you might want to set view-level options on a per-element basis when building out the view.

This simply makes it so that you can call the invoke() of the view helper to fluently get the helper object in which case option methods can be directly called, such as:

$this->formMulticheckbox()->setSeparator('')->render($element);

This functionality is already present in the label view helpers, I'm simply extending it to all other helpers.

Tests:

+ Invoke with no element chains helper (x5, one per form view helper test)