Linker: Don't use Title::setFragment()
[lhc/web/wiklou.git] / includes / htmlform / VFormHTMLForm.php
index f3cba48..325526b 100644 (file)
@@ -50,7 +50,7 @@ class VFormHTMLForm extends HTMLForm {
                return $field;
        }
 
-       function getHTML( $submitResult ) {
+       public function getHTML( $submitResult ) {
                // This is required for VForm HTMLForms that use that style regardless
                // of wgUseMediaWikiUIEverywhere (since they pre-date it).
                // When wgUseMediaWikiUIEverywhere is removed, this should be consolidated
@@ -67,16 +67,16 @@ class VFormHTMLForm extends HTMLForm {
 
        protected function getFormAttributes() {
                $attribs = parent::getFormAttributes();
-               $attribs['class'] = [ 'mw-ui-vform', 'mw-ui-container', 'visualClear' ];
+               $attribs['class'] = [ 'mw-htmlform', 'mw-ui-vform', 'mw-ui-container' ];
                return $attribs;
        }
 
-       function wrapForm( $html ) {
+       public function wrapForm( $html ) {
                // Always discard $this->mWrapperLegend
                return Html::rawElement( 'form', $this->getFormAttributes(), $html );
        }
 
-       function getButtons() {
+       public function getButtons() {
                $buttons = '';
 
                if ( $this->mShowSubmit ) {
@@ -116,6 +116,21 @@ class VFormHTMLForm extends HTMLForm {
                        ) . "\n";
                }
 
+               if ( $this->mShowCancel ) {
+                       $target = $this->mCancelTarget ?: Title::newMainPage();
+                       if ( $target instanceof Title ) {
+                               $target = $target->getLocalURL();
+                       }
+                       $buttons .= Html::element(
+                                       'a',
+                                       [
+                                               'class' => 'mw-ui-button mw-ui-big mw-ui-block',
+                                               'href' => $target,
+                                       ],
+                                       $this->msg( 'cancel' )->text()
+                               ) . "\n";
+               }
+
                foreach ( $this->mButtons as $button ) {
                        $attrs = [
                                'type' => 'submit',