zendframework/zf2 — pull request #5482 by akandels (2013-11-15 19:48:25+00:00)
Title: Add setOption (singular) to Zend\Form\Element to supplement setOptions

There's currently setAttributes/setAttribute for setting attributes on form elements dynamically; but only setOptions for options. This makes it slightly painful to set things like labels on-the-fly: $element->setOptions(array('label' => '...') + $element->getOptions());

I don't see any reason we can't have a setOption($key, $value) as a singular way of setting an option to make it easier for when this behavior is necessary.

Test Results (ZendTest/Form/ElementTest.php):

ZendTest\Form\Element
[x] Can set single option for label