zendframework/zf2 — pull request #1670 by bakura10 (2012-06-28 19:39:30+00:00)
Title: Add form row helper

This is a utility form view helper that renders a very common use case : label (if specified), element and element errors. This is more flexible than a magic view helper that would render the all form, as it allows to add specific markup around every elements.

Basically, it allows to replace this :

get('email');
echo $formLabel->openTag() . $email->getAttribute('label');
echo $this->formInput($email);
echo $this->formElementErrors($email);
echo $formLabel->closeTag();
?>

By this shorter one, making views much more easier to read :

formRow($form->get('email')); ?>

EDIT : here are some more notes about this PR : if no label is set for a specific element, only the input will be drawn, so you don't "absolutely" need to set one for every elements to use this helper.

For multicheckboxes and radio, I prefered to group them inside field sets (which appears to be the more semantic way to do it) instead of generating "id" for elements to allow nested labels (which is prohibited by HTML, anyway).