Allow selection of HTMLForm display format

Add a 'DisplayFormat' configuration value that tells HTMLForm which output
styling should be used. This can be used for example to change the form
to the 'vform' style which uses the Mediawiki.ui css styles.

Change-Id: I04d2959b80a44e31f1e04324b26e6dff5ea5b4a6
This commit is contained in:
Bryan Davis 2015-04-30 08:42:16 -06:00
parent 11f4950bd4
commit c6913cee66
3 changed files with 8 additions and 1 deletions

View File

@ -80,6 +80,10 @@ $wgContactConfig['default'] = array(
// address of the submitter in the subject line // address of the submitter in the subject line
'IncludeIP' => false, 'IncludeIP' => false,
// Display format for the form. See HTMLForm documentation for available
// values.
'DisplayFormat' => 'table',
// Any additional fields to display on the contact form. // Any additional fields to display on the contact form.
// Uses https://www.mediawiki.org/wiki/HTMLForm notation // Uses https://www.mediawiki.org/wiki/HTMLForm notation
// Using any of your own "AdditionalFields" will replce the large text box // Using any of your own "AdditionalFields" will replce the large text box

View File

@ -201,7 +201,9 @@ class SpecialContact extends UnlistedSpecialPage {
); );
} }
$form = new HTMLForm( $formItems, $this->getContext(), "contactpage-{$this->formType}" ); $form = HTMLForm::factory( $config['DisplayFormat'],
$formItems, $this->getContext(), "contactpage-{$this->formType}"
);
$form->setWrapperLegendMsg( 'contactpage-legend' ); $form->setWrapperLegendMsg( 'contactpage-legend' );
$form->setSubmitTextMsg( 'emailsend' ); $form->setSubmitTextMsg( 'emailsend' );
if ( $this->formType != '' ) { if ( $this->formType != '' ) {

View File

@ -25,6 +25,7 @@
"SenderName": null, "SenderName": null,
"RequireDetails": false, "RequireDetails": false,
"IncludeIP": false, "IncludeIP": false,
"DisplayFormat": "table",
"AdditionalFields": { "AdditionalFields": {
"Text": { "Text": {
"label-message": "emailmessage", "label-message": "emailmessage",