Index: trunk/extensions/RecordAdmin/RecordAdmin_body.php |
— | — | @@ -452,6 +452,9 @@ |
453 | 453 | # If values are wikitext, convert to hash |
454 | 454 | if ( !is_array( $values ) ) $values = $this->valuesFromText( $values ); |
455 | 455 | |
| 456 | + # Expand any double-brace expressions in the form content (even in its html) |
| 457 | + #$this->form = preg_replace_callback( "|\{\{.+?\}\}|s", array( $this, 'parsePart' ), $this->form ); |
| 458 | + |
456 | 459 | # Add the values into the form's HTML depending on their type |
457 | 460 | foreach( $this->types as $k => $type ) { |
458 | 461 | |
— | — | @@ -460,9 +463,6 @@ |
461 | 464 | list( $html, $pos ) = $m[0]; |
462 | 465 | $len = strlen( $html ); |
463 | 466 | |
464 | | - # Expand any double-brace expressions in the html form section |
465 | | - $html = preg_replace_callback( "|\{\{.+\}\}|s", array( $this, 'parsePart' ), $html ); |
466 | | - |
467 | 467 | # Modify the element according to its type |
468 | 468 | # - clears default value, then adds new value |
469 | 469 | $v = isset( $values[$k] ) ? $values[$k] : ''; |
— | — | @@ -476,6 +476,7 @@ |
477 | 477 | if ( $v ) $html = preg_replace( "|(/?>)$|", " checked $1", $html ); |
478 | 478 | break; |
479 | 479 | case 'list': |
| 480 | + $html = preg_replace_callback( "|\{\{.+?\}\}|s", array( $this, 'parsePart' ), $html ); |
480 | 481 | $html = preg_replace( "|(<option[^<>]*) selected|i", "$1", $html ); # remove the currently selected option |
481 | 482 | if ( $v ) { |
482 | 483 | foreach( split( "\n", $v ) as $v ) { |
— | — | @@ -499,11 +500,11 @@ |
500 | 501 | /** |
501 | 502 | * Used to parse any braces in select lists when populating form |
502 | 503 | */ |
503 | | - function parsePart($part) { |
| 504 | + function parsePart( $part ) { |
504 | 505 | global $wgUser, $wgParser; |
505 | 506 | $options = ParserOptions::newFromUser( $wgUser ); |
506 | | - $html = $wgParser->parse($part[0], $this->title, $options, true, true )->getText(); |
507 | | - return preg_match("|(<option.+</option>)|is", $html, $m) ? $m[1] : ''; |
| 507 | + $html = $wgParser->parse( $part[0], $this->title, $options, true, true )->getText(); |
| 508 | + return preg_match( "|(<option.+</option>)|is", $html, $m ) ? $m[1] : ''; |
508 | 509 | } |
509 | 510 | |
510 | 511 | /** |