Labels should only not be generated when label=false. Refs #3317
@@ -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 : [];
@@ -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);