jenkins-bot has submitted this change and it was merged.

Change subject: HTMLForms: Support non submit buttons
......................................................................


HTMLForms: Support non submit buttons

There is now a new generic HTMLButtonField class which does
not need to be a submit button.

Change-Id: I451a952bba0c7339b5337e5201417beaee3f16fd
---
M includes/HTMLForm.php
1 file changed, 19 insertions(+), 3 deletions(-)

Approvals:
  IAlex: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php
index b7bdcfd..2d0cefc 100644
--- a/includes/HTMLForm.php
+++ b/includes/HTMLForm.php
@@ -2542,7 +2542,19 @@
  * Add a submit button inline in the form (as opposed to
  * HTMLForm::addButton(), which will add it at the end).
  */
-class HTMLSubmitField extends HTMLFormField {
+class HTMLSubmitField extends HTMLButtonField {
+       protected $buttonType = 'submit';
+}
+
+/**
+ * Adds a generic button inline to the form. Does not do anything, you must add
+ * click handling code in JavaScript. Use a HTMLSubmitField if you merely
+ * wish to add a submit button to a form.
+ *
+ * @since 1.22
+ */
+class HTMLButtonField extends HTMLFormField {
+       protected $buttonType = 'button';
 
        public function __construct( $info ) {
                $info['nodata'] = true;
@@ -2552,7 +2564,6 @@
        public function getInputHTML( $value ) {
                $attr = array(
                        'class' => 'mw-htmlform-submit ' . $this->mClass,
-                       'name' => $this->mName,
                        'id' => $this->mID,
                );
 
@@ -2560,7 +2571,12 @@
                        $attr['disabled'] = 'disabled';
                }
 
-               return Xml::submitButton( $value, $attr );
+               return Html::input(
+                       $this->mName,
+                       $value,
+                       $this->buttonType,
+                       $attr
+               );
        }
 
        protected function needsLabel() {

-- 
To view, visit https://gerrit.wikimedia.org/r/55009
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I451a952bba0c7339b5337e5201417beaee3f16fd
Gerrit-PatchSet: 8
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Mwalker <[email protected]>
Gerrit-Reviewer: Adamw <[email protected]>
Gerrit-Reviewer: IAlex <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Liangent <[email protected]>
Gerrit-Reviewer: Matmarex <[email protected]>
Gerrit-Reviewer: Mwalker <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to