Convert Special:DeletedContributions to use OOUI.
[lhc/web/wiklou.git] / includes / htmlform / HTMLButtonField.php
index 16417fc..64fe7ed 100644 (file)
@@ -6,7 +6,7 @@
  * wish to add a submit button to a form.
  *
  * Additional recognized configuration parameters include:
- * - flags: OOUI flags for the button, see OOUI\\FlaggedElement
+ * - flags: OOUI flags for the button, see OOUI\FlaggedElement
  * - buttonlabel-message: Message to use for the button display text, instead
  *   of the value from 'default'. Overrides 'buttonlabel' and 'buttonlabel-raw'.
  * - buttonlabel: Text to display for the button display text, instead
@@ -35,16 +35,7 @@ class HTMLButtonField extends HTMLFormField {
 
                # Generate the label from a message, if possible
                if ( isset( $info['buttonlabel-message'] ) ) {
-                       $msgInfo = $info['buttonlabel-message'];
-
-                       if ( is_array( $msgInfo ) ) {
-                               $msg = array_shift( $msgInfo );
-                       } else {
-                               $msg = $msgInfo;
-                               $msgInfo = [];
-                       }
-
-                       $this->buttonLabel = $this->msg( $msg, $msgInfo )->parse();
+                       $this->buttonLabel = $this->getMessage( $info['buttonlabel-message'] )->parse();
                } elseif ( isset( $info['buttonlabel'] ) ) {
                        if ( $info['buttonlabel'] === ' ' ) {
                                // Apparently some things set &nbsp directly and in an odd format
@@ -79,13 +70,14 @@ class HTMLButtonField extends HTMLFormField {
                        'id' => $this->mID,
                        'type' => $this->buttonType,
                        'name' => $this->mName,
-                       'value' => $value,
+                       'value' => $this->getDefault(),
                ] + $this->getAttributes( [ 'disabled', 'tabindex' ] );
 
                if ( $this->isBadIE() ) {
                        return Html::element( 'input', $attr );
                } else {
-                       return Html::rawElement( 'button', $attr, $this->buttonLabel ?: htmlspecialchars( $value ) );
+                       return Html::rawElement( 'button', $attr,
+                               $this->buttonLabel ?: htmlspecialchars( $this->getDefault() ) );
                }
        }
 
@@ -97,10 +89,10 @@ class HTMLButtonField extends HTMLFormField {
        public function getInputOOUI( $value ) {
                return new OOUI\ButtonInputWidget( [
                        'name' => $this->mName,
-                       'value' => $value,
+                       'value' => $this->getDefault(),
                        'label' => !$this->isBadIE() && $this->buttonLabel
                                ? new OOUI\HtmlSnippet( $this->buttonLabel )
-                               : $value,
+                               : $this->getDefault(),
                        'type' => $this->buttonType,
                        'classes' => [ 'mw-htmlform-submit', $this->mClass ],
                        'id' => $this->mID,