From c6913cee6693f332248c83f0b885c67b40ed656b Mon Sep 17 00:00:00 2001 From: Bryan Davis Date: Thu, 30 Apr 2015 08:42:16 -0600 Subject: [PATCH] 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 --- ContactPage.php | 4 ++++ ContactPage_body.php | 4 +++- extension.json | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ContactPage.php b/ContactPage.php index e2ae761..072c9d9 100644 --- a/ContactPage.php +++ b/ContactPage.php @@ -80,6 +80,10 @@ $wgContactConfig['default'] = array( // address of the submitter in the subject line 'IncludeIP' => false, + // Display format for the form. See HTMLForm documentation for available + // values. + 'DisplayFormat' => 'table', + // Any additional fields to display on the contact form. // Uses https://www.mediawiki.org/wiki/HTMLForm notation // Using any of your own "AdditionalFields" will replce the large text box diff --git a/ContactPage_body.php b/ContactPage_body.php index 72c4a3b..d7e64a8 100644 --- a/ContactPage_body.php +++ b/ContactPage_body.php @@ -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->setSubmitTextMsg( 'emailsend' ); if ( $this->formType != '' ) { diff --git a/extension.json b/extension.json index cc3c58a..f220b12 100644 --- a/extension.json +++ b/extension.json @@ -25,6 +25,7 @@ "SenderName": null, "RequireDetails": false, "IncludeIP": false, + "DisplayFormat": "table", "AdditionalFields": { "Text": { "label-message": "emailmessage",