Merge "Move up devunt's name to Developers"
[lhc/web/wiklou.git] / includes / htmlform / VFormHTMLForm.php
index c446615..c920ac3 100644 (file)
@@ -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',
@@ -137,9 +152,11 @@ class VFormHTMLForm extends HTMLForm {
                        $buttons .= Html::element( 'input', $attrs ) . "\n";
                }
 
-               $html = Html::rawElement( 'div',
-                       [ 'class' => 'mw-htmlform-submit-buttons' ], "\n$buttons" ) . "\n";
+               if ( !$buttons ) {
+                       return '';
+               }
 
-               return $html;
+               return Html::rawElement( 'div',
+                       [ 'class' => 'mw-htmlform-submit-buttons' ], "\n$buttons" ) . "\n";
        }
 }