Merge "OutputPage.php: Remove misleading comment"
[lhc/web/wiklou.git] / includes / specialpage / FormSpecialPage.php
index fd3bc7b..d22875b 100644 (file)
@@ -74,20 +74,31 @@ abstract class FormSpecialPage extends SpecialPage {
                return strtolower( $this->getName() );
        }
 
+       /**
+        * Get display format for the form. See HTMLForm documentation for available values.
+        *
+        * @since 1.25
+        * @return string
+        */
+       protected function getDisplayFormat() {
+               return 'table';
+       }
+
        /**
         * Get the HTMLForm to control behavior
         * @return HTMLForm|null
         */
        protected function getForm() {
-               $this->fields = $this->getFormFields();
-
-               $form = new HTMLForm( $this->fields, $this->getContext(), $this->getMessagePrefix() );
+               $form = HTMLForm::factory(
+                       $this->getDisplayFormat(),
+                       $this->getFormFields(),
+                       $this->getContext(),
+                       $this->getMessagePrefix()
+               );
                $form->setSubmitCallback( array( $this, 'onSubmit' ) );
-               // If the form is a compact vertical form, then don't output this ugly
-               // fieldset surrounding it.
-               // XXX Special pages can setDisplayFormat to 'vform' in alterForm(), but that
-               // is called after this.
-               if ( !$form->isVForm() ) {
+               if ( $this->getDisplayFormat() !== 'ooui' ) {
+                       // No legend and wrapper by default in OOUI forms, but can be set manually
+                       // from alterForm()
                        $form->setWrapperLegendMsg( $this->getMessagePrefix() . '-legend' );
                }
 
@@ -158,7 +169,6 @@ abstract class FormSpecialPage extends SpecialPage {
         * Failures here must throw subclasses of ErrorPageError.
         * @param User $user
         * @throws UserBlockedError
-        * @return bool True
         */
        protected function checkExecutePermissions( User $user ) {
                $this->checkPermissions();
@@ -171,8 +181,6 @@ abstract class FormSpecialPage extends SpecialPage {
                if ( $this->requiresWrite() ) {
                        $this->checkReadOnly();
                }
-
-               return true;
        }
 
        /**