Skip to content

Commit

Permalink
Fix radio widget not generating labels.
Browse files Browse the repository at this point in the history
Labels should only not be generated when label=false.

Refs #3317
  • Loading branch information
markstory committed Apr 15, 2014
1 parent f7703db commit c0dae5b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/View/Widget/Radio.php
Expand Up @@ -202,7 +202,7 @@ protected function _renderInput($val, $text, $data) {
* @return string Generated label.
*/
protected function _renderLabel($radio, $label, $input, $escape) {
if (!$label) {
if ($label === false) {
return false;
}
$labelAttrs = is_array($label) ? $label : [];
Expand Down
1 change: 1 addition & 0 deletions tests/TestCase/View/Widget/RadioTest.php
Expand Up @@ -50,6 +50,7 @@ public function testRenderSimple() {
$radio = new Radio($this->templates, $label);
$data = [
'name' => 'Crayons[color]',
'label' => null,
'options' => ['r' => 'Red', 'b' => 'Black']
];
$result = $radio->render($data);
Expand Down

0 comments on commit c0dae5b

Please sign in to comment.