Index: trunk/extensions/SemanticForms/includes/SF_Utils.php |
— | — | @@ -157,7 +157,21 @@ |
158 | 158 | * Function to return the Property based on the xml passed from the PageSchema extension |
159 | 159 | */ |
160 | 160 | public static function createPageSchemasObject( $objectName, $xmlForField, &$object ) { |
161 | | - $sfarray = array(); |
| 161 | + $sfarray = array(); |
| 162 | + $formName=""; |
| 163 | + if ( $objectName == "Form" ) { |
| 164 | + foreach ( $xmlForField->children() as $tag => $child ) { |
| 165 | + if ( $tag == $objectName ) { |
| 166 | + $formName = (string) $child->attributes()->name; |
| 167 | + $sfarray['name'] = $formName; |
| 168 | + foreach ($child->children() as $tag => $formelem) { |
| 169 | + $sfarray[(string)$tag] = (string)$formelem; |
| 170 | + } |
| 171 | + } |
| 172 | + } |
| 173 | + $object['sf'] = $sfarray; |
| 174 | + return true; |
| 175 | + } |
162 | 176 | if ( $objectName == "FormInput" ) { |
163 | 177 | foreach ( $xmlForField->children() as $tag => $child ) { |
164 | 178 | if ( $tag == $objectName ) { |
— | — | @@ -217,11 +231,12 @@ |
218 | 232 | public static function getFilledHtmlTextForPS( $pageSchemaObj, &$text_extensions ){ |
219 | 233 | $template_fields = array(); |
220 | 234 | $html_text = ""; |
221 | | - $template_all = $pageSchemaObj->getTemplates(); |
| 235 | + $template_all = $pageSchemaObj->getTemplates(); |
| 236 | + $html_text_array = array(); |
222 | 237 | foreach ( $template_all as $template ) { |
223 | 238 | $field_all = $template->getFields(); |
224 | 239 | $field_count = 0; //counts the number of fields |
225 | | - $html_text_array = array(); |
| 240 | + |
226 | 241 | foreach( $field_all as $field ) { //for each Field, retrieve smw properties and fill $prop_name , $prop_type |
227 | 242 | $field_count++; |
228 | 243 | $sf_array = $field->getObject('FormInput');//this returns an array with property values filled |
— | — | @@ -336,6 +351,7 @@ |
337 | 352 | *Thi Function parses the Field elements in the xml of the pages. Hooks for PageSchemas extension |
338 | 353 | */ |
339 | 354 | public static function parseFieldElements( $field_xml, &$text_object ) { |
| 355 | + |
340 | 356 | foreach ( $field_xml->children() as $tag => $child ) { |
341 | 357 | if ( $tag == "FormInput" ) { |
342 | 358 | $text = ""; |