Permalink
Browse files

Setting false value for checkboxes with true default, if they aren't …

…set to true in the DB.
  • Loading branch information...
1 parent 809d988 commit 4a6a1128e4f31a8c01eab14b33c1529f4cd41072 Andy Adams committed Mar 29, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 classes/struts/options.php
@@ -119,6 +119,10 @@ public function initialize() {
foreach ( $this->all_options() as $option ) {
if ( isset( $option_values[$option->name()] ) ) {
$option->value( $option_values[$option->name()] );
+ } elseif ( ! isset( $option_values[$option->name()] ) && $option->default_value() === true ) {
+ // In the case of checkboxes if the value is empty and the default is true we need
+ // to explicitly set the false value here to prevent the default from always being set.
+ $option->value( false );
} else {
$option->value( $option->default_value() );
}

0 comments on commit 4a6a112

Please sign in to comment.