Skip to content

Commit

Permalink
Fixing doc blocks and minor refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Oct 31, 2009
1 parent 9ed7a5c commit 83caf50
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cake/libs/view/helpers/form.php
Expand Up @@ -889,24 +889,24 @@ function input($fieldName, $options = array()) {
*
* - `value` - the value of the checkbox
* - `checked` - boolean indicate that this checkbox is checked.
* - `hiddenField` - boolean to indicate if you want the results of radio() to include
* a hidden input with a value of ''. This is useful for creating radio sets that non-continuous
* - `hiddenField` - boolean to indicate if you want the results of checkbox() to include
* a hidden input with a value of ''.
*
* @param string $fieldName Name of a field, like this "Modelname.fieldname"
* @param array $options Array of HTML attributes.
* @return string An HTML text input element
*/
function checkbox($fieldName, $options = array()) {
$options = $this->_initInputField($fieldName, $options);
$options = $this->_initInputField($fieldName, $options) + array('hiddenField' => true);
$value = current($this->value());
$output = "";

if (!isset($options['value']) || empty($options['value'])) {
if (empty($options['value'])) {
$options['value'] = 1;
} elseif (!empty($value) && $value === $options['value']) {
$options['checked'] = 'checked';
}
if (!isset($options['hiddenField']) || $options['hiddenField'] != false) {
if ($options['hiddenField']) {
$hiddenOptions = array(
'id' => $options['id'] . '_', 'name' => $options['name'],
'value' => '0', 'secure' => false
Expand Down

0 comments on commit 83caf50

Please sign in to comment.