HTMLSubmitField is more useful as an inline button than an alias for HTMLForm::addBut...
authorHappy-melon <happy-melon@users.mediawiki.org>
Sat, 13 Mar 2010 15:33:18 +0000 (15:33 +0000)
committerHappy-melon <happy-melon@users.mediawiki.org>
Sat, 13 Mar 2010 15:33:18 +0000 (15:33 +0000)
includes/HTMLForm.php

index a6c7946..008f0ec 100644 (file)
@@ -1362,18 +1362,31 @@ class HTMLHiddenField extends HTMLFormField {
        public function getInputHTML( $value ){ return ''; }
 }
 
+/**
+ * Add a submit button inline in the form (as opposed to 
+ * HTMLForm::addButton(), which will add it at the end).
+ */
 class HTMLSubmitField extends HTMLFormField {
        
-       public function getTableRow( $value ){
-               $this->mParent->addButton(
-                       $this->mParams['name'],
-                       $this->mParams['default'],
-                       isset($this->mParams['id']) ? $this->mParams['id'] : null,
-                       $this->getTooltipAndAccessKey()
+       function __construct( $info ) {
+               $info['nodata'] = true;
+               parent::__construct( $info );
+       }
+
+       function getInputHTML( $value ) {
+               return Xml::submitButton( 
+                       $value, 
+                       array( 
+                               'class' => 'mw-htmlform-submit',
+                               'name' => $this->mName,
+                               'id' => $this->mID,
+                       ) 
                );
        }
-       
-       public function getInputHTML( $value ){ return ''; }
+
+       protected function needsLabel() {
+               return false;
+       }
 }
 
 class HTMLEditTools extends HTMLFormField {