Browse Source

Fix radio widget not generating labels.

Labels should only not be generated when label=false.

Refs #3317
mark_story 12 years ago
parent
commit
c0dae5ba46
2 changed files with 2 additions and 1 deletions
  1. 1 1
      src/View/Widget/Radio.php
  2. 1 0
      tests/TestCase/View/Widget/RadioTest.php

+ 1 - 1
src/View/Widget/Radio.php

@@ -202,7 +202,7 @@ class Radio implements WidgetInterface {
  * @return string Generated label.
  */
 	protected function _renderLabel($radio, $label, $input, $escape) {
-		if (!$label) {
+		if ($label === false) {
 			return false;
 		}
 		$labelAttrs = is_array($label) ? $label : [];

+ 1 - 0
tests/TestCase/View/Widget/RadioTest.php

@@ -50,6 +50,7 @@ class RadioTest extends TestCase {
 		$radio = new Radio($this->templates, $label);
 		$data = [
 			'name' => 'Crayons[color]',
+			'label' => null,
 			'options' => ['r' => 'Red', 'b' => 'Black']
 		];
 		$result = $radio->render($data);