Skip to content

Commit

Permalink
FormHelper : use the empty option for radio buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
challet authored and markstory committed Apr 7, 2012
1 parent 4eea722 commit 00b2c49
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/Cake/View/Helper/FormHelper.php
Expand Up @@ -1353,6 +1353,14 @@ public function checkbox($fieldName, $options = array()) {
public function radio($fieldName, $options = array(), $attributes = array()) {
$attributes = $this->_initInputField($fieldName, $attributes);

$showEmpty = $this->_extractOption('empty', $attributes);
if ($showEmpty) {
$showEmpty = ($showEmpty === true) ? __('empty') : $showEmpty;
$options = array_reverse($options, true);
$options[''] = $showEmpty;
$options = array_reverse($options, true);
}

$legend = false;
if (isset($attributes['legend'])) {
$legend = $attributes['legend'];
Expand Down

0 comments on commit 00b2c49

Please sign in to comment.