Yaron Koren has submitted this change and it was merged.

Change subject: Fix to ignore default value in 'checkboxes' for existing pages
......................................................................


Fix to ignore default value in 'checkboxes' for existing pages

Change-Id: Ia3d8efb9566512acd3b7588f361efec0728dbd45
---
M includes/SF_FormField.php
M includes/SF_FormPrinter.php
2 files changed, 3 insertions(+), 3 deletions(-)

Approvals:
  Yaron Koren: Checked; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/SF_FormField.php b/includes/SF_FormField.php
index 0f30401..659b725 100644
--- a/includes/SF_FormField.php
+++ b/includes/SF_FormField.php
@@ -413,7 +413,7 @@
                return $f;
        }
 
-       function getCurrentValue( $template_instance_query_values, 
$form_submitted ) {
+       function getCurrentValue( $template_instance_query_values, 
$form_submitted, $source_is_page ) {
                // Get the value from the request, if
                // it's there, and if it's not an array.
                $cur_value = null;
@@ -487,7 +487,7 @@
                        }
                }
 
-               if ( empty( $cur_value ) && !$form_submitted ) {
+               if ( !$source_is_page && empty( $cur_value ) && 
!$form_submitted ) {
                        if ( !is_null( $this->mDefaultValue ) ) {
                                // Set to the default value specified in the 
form, if it's there.
                                return $this->mDefaultValue;
diff --git a/includes/SF_FormPrinter.php b/includes/SF_FormPrinter.php
index a51a67c..d9adedd 100644
--- a/includes/SF_FormPrinter.php
+++ b/includes/SF_FormPrinter.php
@@ -981,7 +981,7 @@
                                        $field_name = trim( $tag_components[1] 
);
                                        $form_field = 
SFFormField::newFromFormFieldTag( $tag_components, $template_name, $all_fields, 
$form_is_disabled, $allow_multiple, $strict_parsing );
                                        $fullFieldName = $template_name . '[' . 
$field_name . ']';
-                                       $cur_value = 
$form_field->getCurrentValue( $template_instance_query_values, $form_submitted 
);
+                                       $cur_value = 
$form_field->getCurrentValue( $template_instance_query_values, $form_submitted, 
$source_is_page );
 
                                        // If the user is editing a page, and 
that page contains a call to
                                        // the template being processed, get 
the current field's value

-- 
To view, visit https://gerrit.wikimedia.org/r/263159
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia3d8efb9566512acd3b7588f361efec0728dbd45
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticForms
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <yaro...@gmail.com>
Gerrit-Reviewer: Yaron Koren <yaro...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to