Index: trunk/extensions/SemanticForms/includes/SF_TemplateField.php |
— | — | @@ -154,8 +154,9 @@ |
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
158 | | - * Creates the text of a template, when called from either |
159 | | - * Special:CreateTemplate or Special:CreateClass. |
| 158 | + * Creates the text of a template, when called from |
| 159 | + * Special:CreateTemplate, Special:CreateClass or the Page Schemas |
| 160 | + * extension. |
160 | 161 | * |
161 | 162 | * @TODO: There's really no good reason why this method is contained |
162 | 163 | * within this class. |
— | — | @@ -179,11 +180,10 @@ |
180 | 181 | </pre> |
181 | 182 | $template_footer |
182 | 183 | </noinclude><includeonly> |
183 | | - |
184 | 184 | END; |
185 | 185 | // Only add a call to #set_internal if the Semantic Internal |
186 | 186 | // Objects extension is also installed. |
187 | | - if ( !empty( $internal_obj_property) && class_exists( 'SIOInternalObject' ) ) { |
| 187 | + if ( !empty( $internal_obj_property ) && class_exists( 'SIOInternalObject' ) ) { |
188 | 188 | $setInternalText = '{{#set_internal:' . $internal_obj_property; |
189 | 189 | } else { |
190 | 190 | $setInternalText = null; |
— | — | @@ -211,19 +211,20 @@ |
212 | 212 | $tableText .= "! " . $field->mLabel . "\n"; |
213 | 213 | if ( empty( $field->mSemanticProperty ) ) { |
214 | 214 | $tableText .= "| {{{" . $field->mFieldName . "|}}}\n"; |
215 | | - // if this field is meant to contain a list, |
216 | | - // add on an 'arraymap' function, that will |
217 | | - // call this semantic markup tag on every |
218 | | - // element in the list |
219 | 215 | } elseif ( !is_null( $setInternalText ) ) { |
| 216 | + $tableText .= "| {{{" . $field->mFieldName . "|}}}\n"; |
220 | 217 | if ( $field->mIsList ) { |
221 | 218 | $setInternalText .= '|' . $field->mSemanticProperty . '#list={{{' . $field->mFieldName . '|}}}'; |
222 | 219 | } else { |
223 | 220 | $setInternalText .= '|' . $field->mSemanticProperty . '={{{' . $field->mFieldName . '|}}}'; |
224 | 221 | } |
225 | 222 | } elseif ( $field->mIsList ) { |
226 | | - // find a string that's not in the semantic |
227 | | - // field call, to be used as the variable |
| 223 | + // If this field is meant to contain a list, |
| 224 | + // add on an 'arraymap' function, that will |
| 225 | + // call this semantic markup tag on every |
| 226 | + // element in the list. |
| 227 | + // Find a string that's not in the semantic |
| 228 | + // field call, to be used as the variable. |
228 | 229 | $var = "x"; // default - use this if all the attempts fail |
229 | 230 | if ( strstr( $field->mSemanticProperty, $var ) ) { |
230 | 231 | $var_options = array( 'y', 'z', 'xx', 'yy', 'zz', 'aa', 'bb', 'cc' ); |
— | — | @@ -252,9 +253,14 @@ |
253 | 254 | |
254 | 255 | END; |
255 | 256 | } |
256 | | - $tableText .= "|}\n"; |
257 | | - if ( !is_null( $setInternalText ) ) { |
258 | | - $setInternalText .= "}}\n"; |
| 257 | + $tableText .= "|}"; |
| 258 | + // Leave out newlines if there's an internal property |
| 259 | + // set here (which would mean that there are meant to be |
| 260 | + // multiple instances of this template.) |
| 261 | + if ( is_null( $setInternalText ) ) { |
| 262 | + $tableText .= "\n"; |
| 263 | + } else { |
| 264 | + $setInternalText .= "}}"; |
259 | 265 | $text .= $setInternalText; |
260 | 266 | } |
261 | 267 | |