Index: trunk/extensions/SemanticForms/includes/SF_PageSchemas.php |
— | — | @@ -17,13 +17,12 @@ |
18 | 18 | */ |
19 | 19 | public static function createPageSchemasObject( $objectName, $xmlForField, &$object ) { |
20 | 20 | $sfarray = array(); |
21 | | - $formName = ""; |
22 | 21 | if ( $objectName == "semanticforms_Form" ) { |
23 | 22 | foreach ( $xmlForField->children() as $tag => $child ) { |
24 | 23 | if ( $tag == $objectName ) { |
25 | 24 | $formName = (string) $child->attributes()->name; |
26 | 25 | $sfarray['name'] = $formName; |
27 | | - foreach ($child->children() as $tag => $formelem) { |
| 26 | + foreach ( $child->children() as $tag => $formelem ) { |
28 | 27 | $sfarray[(string)$tag] = (string)$formelem; |
29 | 28 | } |
30 | 29 | $object['sf'] = $sfarray; |
— | — | @@ -53,6 +52,7 @@ |
54 | 53 | * Creates Page Schemas XML for form-wide information. |
55 | 54 | */ |
56 | 55 | public static function getSchemaXML( $request, &$xmlArray ) { |
| 56 | + $xml = ''; |
57 | 57 | foreach ( $request->getValues() as $var => $val ) { |
58 | 58 | if ( $var == 'sf_form_name' ) { |
59 | 59 | $xml = '<semanticforms_Form name="' . $val . '" >'; |
— | — | @@ -210,12 +210,18 @@ |
211 | 211 | } |
212 | 212 | |
213 | 213 | public static function getFormName( $psSchemaObj ) { |
214 | | - $formData = $psSchemaObj->getObject( 'semanticforms_Form' ); |
215 | | - return $formData['sf']['name']; |
| 214 | + $mainFormInfo = self::getMainFormInfo( $psSchemaObj ); |
| 215 | + if ( is_null( $mainFormInfo ) || !array_key_exists( 'name', $mainFormInfo ) ) { |
| 216 | + return null; |
| 217 | + } |
| 218 | + return $mainFormInfo['name'] |
216 | 219 | } |
217 | 220 | |
218 | 221 | public static function getMainFormInfo( $psSchemaObj ) { |
219 | 222 | $formData = $psSchemaObj->getObject( 'semanticforms_Form' ); |
| 223 | + if ( !array_key_exists( 'sf', $formData ) ) { |
| 224 | + return null; |
| 225 | + } |
220 | 226 | return $formData['sf']; |
221 | 227 | } |
222 | 228 | |