X-Git-Url: https://git.cyclocoop.org/%242?a=blobdiff_plain;f=includes%2Fhtmlform%2FHTMLForm.php;h=f2c2aab3710098b9c0ea61d9700da6aa265e6fdd;hb=5eda39e04ba76d73885fa1d7554e5e8d5622e47a;hp=bef4dc091e35542f6ecf7850bd001c2c24e30944;hpb=fd62703d505e3e233fb7842d7349a4e9302bb5f4;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/htmlform/HTMLForm.php b/includes/htmlform/HTMLForm.php index bef4dc091e..f2c2aab371 100644 --- a/includes/htmlform/HTMLForm.php +++ b/includes/htmlform/HTMLForm.php @@ -238,6 +238,7 @@ class HTMLForm extends ContextSource { */ protected $availableSubclassDisplayFormats = array( 'vform', + 'ooui', ); /** @@ -256,6 +257,9 @@ class HTMLForm extends ContextSource { case 'vform': $reflector = new ReflectionClass( 'VFormHTMLForm' ); return $reflector->newInstanceArgs( $arguments ); + case 'ooui': + $reflector = new ReflectionClass( 'OOUIHTMLForm' ); + return $reflector->newInstanceArgs( $arguments ); default: $reflector = new ReflectionClass( 'HTMLForm' ); $form = $reflector->newInstanceArgs( $arguments ); @@ -1392,6 +1396,17 @@ class HTMLForm extends ContextSource { Html::rawElement( 'tbody', array(), "\n$html\n" ) ) . "\n"; } elseif ( $displayFormat === 'inline' ) { $html = Html::rawElement( 'span', $attribs, "\n$html\n" ); + } elseif ( $displayFormat === 'ooui' ) { + $config = array( + 'classes' => $classes, + ); + if ( $sectionName ) { + $config['id'] = Sanitizer::escapeId( $sectionName ); + } + $fieldset = new OOUI\FieldsetLayout( $config ); + // Ewww. We should pass this as $config['items'], but there might be string snippets. + $fieldset->group->appendContent( new OOUI\HtmlSnippet( $html ) ); + $html = $fieldset->toString(); } else { $html = Html::rawElement( 'div', $attribs, "\n$html\n" ); }