Merge "Fix HTMLForm's documentation example"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 26 Apr 2013 15:08:40 +0000 (15:08 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 26 Apr 2013 15:08:40 +0000 (15:08 +0000)
1  2 
includes/HTMLForm.php

diff --combined includes/HTMLForm.php
@@@ -83,9 -83,8 +83,8 @@@
   * $form = new HTMLForm( $someFields );
   * $form->setMethod( 'get' )
   *      ->setWrapperLegendMsg( 'message-key' )
-  *      ->suppressReset()
   *      ->prepareForm()
-  *      ->displayForm();
+  *      ->displayForm( '' );
   * @endcode
   * Note that you will have prepareForm and displayForm at the end. Other
   * methods call done after that would simply not be part of the form :(
@@@ -2542,19 -2541,7 +2541,19 @@@ class HTMLHiddenField extends HTMLFormF
   * 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;
        public function getInputHTML( $value ) {
                $attr = array(
                        'class' => 'mw-htmlform-submit ' . $this->mClass,
 -                      'name' => $this->mName,
                        'id' => $this->mID,
                );
  
                        $attr['disabled'] = 'disabled';
                }
  
 -              return Xml::submitButton( $value, $attr );
 +              return Html::input(
 +                      $this->mName,
 +                      $value,
 +                      $this->buttonType,
 +                      $attr
 +              );
        }
  
        protected function needsLabel() {