See unit tests for examples of usage.
I'll update the documentation once these are accepted.
add 'afterOption' and 'beforeOption' for radio inputs
add the ability to use sprintf format in 'afterOption' and 'beforeOpt…
…ion' with the values of options
might be related to #864
Why not expose this as one option 'wrap' that defines the wrapping content for a radio button? Using some simple sprintf() formatting should work fine for this kind of use as there are only two elements that would need to be inserted into the wrapping html.
One other use case is to add pictures and links, related to each option, to illustrate them or suggest more information.
This one case can be seen in action in the tests.
I would suggest that 'afterOption' and 'beforeOption' allows for more flexibility than one 'wrap' option.
But only adding one option keeps the API smaller, requires less mental memory to remember the names of all the options, fewer tests, and less documentation.
For example the test that contains a link/img could be written as:
$result = $this->Form->radio(
array('A' => 'option A', 'B' => 'option B'),
'wrapInput' => '<img src="/img/:value.png" alt=":title" />:input<a href="/option/:value">learn more about :title</a>',
The above would use String::insert()/strtr as it is easier to read than sprintf when there are many values being inserted. I'm hoping to coalesce many of the existing options to this style for 3.0 as the existing pile of format/append/prepend options have gotten out of control.
Please reopen targeting the 2.4 branch