Restore #mw-history-search id on history action fieldset
authorjdlrobson <jdlrobson@gmail.com>
Wed, 27 Mar 2019 22:52:29 +0000 (15:52 -0700)
committerBartosz Dziewoński <matma.rex@gmail.com>
Fri, 29 Mar 2019 15:28:36 +0000 (15:28 +0000)
Change-Id: I3551667b1f64a3cd9227b07df2a215ccb701ea5d

includes/actions/HistoryAction.php
includes/htmlform/HTMLForm.php
includes/htmlform/OOUIHTMLForm.php

index 7ff6f7d..06e214f 100644 (file)
@@ -270,6 +270,7 @@ class HistoryAction extends FormlessAction {
                        ->setAction( wfScript() )
                        ->setId( 'mw-history-searchform' )
                        ->setSubmitText( $this->msg( 'historyaction-submit' )->text() )
                        ->setAction( wfScript() )
                        ->setId( 'mw-history-searchform' )
                        ->setSubmitText( $this->msg( 'historyaction-submit' )->text() )
+                       ->setWrapperAttributes( [ 'id' => 'mw-history-search' ] )
                        ->setWrapperLegend( $this->msg( 'history-fieldset-title' )->text() );
                $htmlForm->loadData();
 
                        ->setWrapperLegend( $this->msg( 'history-fieldset-title' )->text() );
                $htmlForm->loadData();
 
index ee0da7b..3c9b23c 100644 (file)
@@ -233,6 +233,7 @@ class HTMLForm extends ContextSource {
        protected $mButtons = [];
 
        protected $mWrapperLegend = false;
        protected $mButtons = [];
 
        protected $mWrapperLegend = false;
+       protected $mWrapperAttributes = [];
 
        /**
         * Salt for the edit token.
 
        /**
         * Salt for the edit token.
@@ -1089,7 +1090,7 @@ class HTMLForm extends ContextSource {
                # Include a <fieldset> wrapper for style, if requested.
                if ( $this->mWrapperLegend !== false ) {
                        $legend = is_string( $this->mWrapperLegend ) ? $this->mWrapperLegend : false;
                # Include a <fieldset> wrapper for style, if requested.
                if ( $this->mWrapperLegend !== false ) {
                        $legend = is_string( $this->mWrapperLegend ) ? $this->mWrapperLegend : false;
-                       $html = Xml::fieldset( $legend, $html );
+                       $html = Xml::fieldset( $legend, $html, $this->mWrapperAttributes );
                }
 
                return Html::rawElement(
                }
 
                return Html::rawElement(
@@ -1534,6 +1535,19 @@ class HTMLForm extends ContextSource {
                return $this;
        }
 
                return $this;
        }
 
+       /**
+        * For internal use only. Use is discouraged, and should only be used where
+        * support for gadgets/user scripts is warranted.
+        * @param array $attributes
+        * @internal
+        * @return HTMLForm $this for chaining calls
+        */
+       public function setWrapperAttributes( $attributes ) {
+               $this->mWrapperAttributes = $attributes;
+
+               return $this;
+       }
+
        /**
         * Prompt the whole form to be wrapped in a "<fieldset>", with
         * this message as its "<legend>" element.
        /**
         * Prompt the whole form to be wrapped in a "<fieldset>", with
         * this message as its "<legend>" element.
index e7e3ff6..738db09 100644 (file)
@@ -284,7 +284,7 @@ class OOUIHTMLForm extends HTMLForm {
                                                'content' => new OOUI\HtmlSnippet( $html )
                                        ] ),
                                ],
                                                'content' => new OOUI\HtmlSnippet( $html )
                                        ] ),
                                ],
-                       ] );
+                       ] + OOUI\Element::configFromHtmlAttributes( $this->mWrapperAttributes ) );
                } else {
                        $content = new OOUI\HtmlSnippet( $html );
                }
                } else {
                        $content = new OOUI\HtmlSnippet( $html );
                }