Commit 57adf1dd authored by Eric Windham's avatar Eric Windham Committed by GitHub

Merge pull request #3366 from wpninjas/issue#3287

Added additional check to logic to allow checkboxes to be edited on the edit submission page.
parents fc117913 a2552209
......@@ -53,8 +53,8 @@ class NF_Fields_Checkbox extends NF_Abstracts_Input
*/
public function admin_form_element( $id, $value )
{
// If the checkboxes value is one...
if( 1 == $value ) {
// If the checkboxes value is 1 or on...
if( 'on' == $value || 1 == $value ) {
// ...this variable to checked.
$checked = 'checked';
} else {
......@@ -81,14 +81,14 @@ class NF_Fields_Checkbox extends NF_Abstracts_Input
// If the field type is equal to checkbox...
if( 'checkbox' == $field->get_setting( 'type' ) ) {
// Backwards compatibility check for the new checked value setting.
if( null == $field->get_setting( 'checked_value' ) && 1 == $value ) {
if( null == $field->get_setting( 'checked_value' ) && 1 == $value || 'on' == $value ) {
return __( 'Checked', 'ninja-forms' );
} elseif( null == $field->get_setting( 'unchecked_value' ) && 0 == $value ) {
return __( 'Unchecked', 'ninja-forms');
}
// If the field value is set to 1....
if( 1 == $value ) {
if( 1 == $value || 'on' == $value) {
// Set the value to the checked value setting.
$value = $field->get_setting( 'checked_value' );
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment