Index: trunk/extensions/SemanticForms/includes/SF_PageSchemas.php |
— | — | @@ -157,14 +157,14 @@ |
158 | 158 | return $xmlPerField; |
159 | 159 | } |
160 | 160 | |
| 161 | + public static function getDisplayColor() { |
| 162 | + return '#CF9'; |
| 163 | + } |
| 164 | + |
161 | 165 | public static function getSchemaDisplayString() { |
162 | 166 | return 'Form'; |
163 | 167 | } |
164 | 168 | |
165 | | - public static function getDisplayColor() { |
166 | | - return '#CF9'; |
167 | | - } |
168 | | - |
169 | 169 | public static function getSchemaEditingHTML( $pageSchemaObj ) { |
170 | 170 | $form_array = array(); |
171 | 171 | $hasExistingValues = false; |
— | — | @@ -301,7 +301,25 @@ |
302 | 302 | } |
303 | 303 | |
304 | 304 | public static function getMainFormInfo( $pageSchemaObj ) { |
305 | | - return $pageSchemaObj->getObject( 'semanticforms_Form' ); |
| 305 | + //return $pageSchemaObj->getObject( 'semanticforms_Form' ); |
| 306 | + // We don't just call getObject() here, because sometimes, for |
| 307 | + // some reason, this gets called before SF registers itself |
| 308 | + // with Page Schemas, which means that getObject() would return |
| 309 | + // null. Instead, we directly call the code that would have |
| 310 | + // been called. |
| 311 | + $xml = $pageSchemaObj->getXML(); |
| 312 | + foreach ( $xml->children() as $tag => $child ) { |
| 313 | + if ( $tag == "semanticforms_Form" ) { |
| 314 | + $sfarray = array(); |
| 315 | + $formName = (string)$child->attributes()->name; |
| 316 | + $sfarray['name'] = $formName; |
| 317 | + foreach ( $child->children() as $tag => $formelem ) { |
| 318 | + $sfarray[$tag] = (string)$formelem; |
| 319 | + } |
| 320 | + return $sfarray; |
| 321 | + } |
| 322 | + } |
| 323 | + return array(); |
306 | 324 | } |
307 | 325 | |
308 | 326 | public static function getFormFieldInfo( $psTemplate, $template_fields ) { |
— | — | @@ -465,8 +483,6 @@ |
466 | 484 | ); |
467 | 485 | $form_templates[] = $form_template; |
468 | 486 | } |
469 | | - //print_r($form_templates); |
470 | | - //die; |
471 | 487 | Job::batchInsert( $jobs ); |
472 | 488 | |
473 | 489 | // Create form, if it's specified. |
— | — | @@ -544,7 +560,7 @@ |
545 | 561 | /** |
546 | 562 | * Displays data on a single form input in the Page Schemas XML. |
547 | 563 | */ |
548 | | - public static function getFieldDisplayInfo( $fieldXML ) { |
| 564 | + public static function getFieldDisplayValues( $fieldXML ) { |
549 | 565 | foreach ( $fieldXML->children() as $tag => $child ) { |
550 | 566 | if ( $tag == "semanticforms_FormInput" ) { |
551 | 567 | $inputName = $child->attributes()->name; |