Yaron Koren has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/271620

Change subject: Follow-up to c9ac2c4
......................................................................

Follow-up to c9ac2c4

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


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticForms 
refs/changes/20/271620/1

diff --git a/includes/SF_FormField.php b/includes/SF_FormField.php
index 03126b3..b8910f9 100644
--- a/includes/SF_FormField.php
+++ b/includes/SF_FormField.php
@@ -421,7 +421,7 @@
                return $f;
        }
 
-       function getCurrentValue( $template_instance_query_values, 
$form_submitted, $source_is_page ) {
+       function getCurrentValue( $template_instance_query_values, 
$form_submitted, $source_is_page, $all_instances_printed ) {
                // Get the value from the request, if
                // it's there, and if it's not an array.
                $cur_value = null;
@@ -502,7 +502,8 @@
                // Default values in new instances of multiple-instance
                // templates should always be set, even for existing pages.
                $part_of_multiple = array_key_exists( 'part_of_multiple', 
$this->mFieldArgs );
-               if ( ( !$source_is_page || $part_of_multiple ) && 
!$form_submitted ) {
+               $printing_starter_instance = $part_of_multiple && 
$all_instances_printed;
+               if ( ( !$source_is_page || $printing_starter_instance ) && 
!$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 0e0a1c3..be002f4a 100644
--- a/includes/SF_FormPrinter.php
+++ b/includes/SF_FormPrinter.php
@@ -799,7 +799,7 @@
                                        // among others.
                                        $field_name = trim( $tag_components[1] 
);
                                        $form_field = 
SFFormField::newFromFormFieldTag( $tag_components, $tif, $form_is_disabled );
-                                       $cur_value = 
$form_field->getCurrentValue( $tif->getValuesFromSubmit(), $form_submitted, 
$source_is_page );
+                                       $cur_value = 
$form_field->getCurrentValue( $tif->getValuesFromSubmit(), $form_submitted, 
$source_is_page, $tif->allInstancesPrinted() );
                                        if ( $form_field->holdsTemplate() ) {
                                                $placeholderFields[] = 
self::placeholderFormat( $tif->getTemplateName(), $field_name );
                                        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaf608d0f5ab8a0744efb29be927c6e443dca4661
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticForms
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to