From dc180ca64fe000e3cb9a01c3a6b85e36231e0a1b Mon Sep 17 00:00:00 2001 From: jdlrobson Date: Wed, 27 Mar 2019 15:52:29 -0700 Subject: [PATCH] Restore #mw-history-search id on history action fieldset Change-Id: I3551667b1f64a3cd9227b07df2a215ccb701ea5d --- includes/actions/HistoryAction.php | 1 + includes/htmlform/HTMLForm.php | 16 +++++++++++++++- includes/htmlform/OOUIHTMLForm.php | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/includes/actions/HistoryAction.php b/includes/actions/HistoryAction.php index 7ff6f7df2d..06e214f37e 100644 --- a/includes/actions/HistoryAction.php +++ b/includes/actions/HistoryAction.php @@ -270,6 +270,7 @@ class HistoryAction extends FormlessAction { ->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(); diff --git a/includes/htmlform/HTMLForm.php b/includes/htmlform/HTMLForm.php index ee0da7b64f..3c9b23c8e5 100644 --- a/includes/htmlform/HTMLForm.php +++ b/includes/htmlform/HTMLForm.php @@ -233,6 +233,7 @@ class HTMLForm extends ContextSource { protected $mButtons = []; protected $mWrapperLegend = false; + protected $mWrapperAttributes = []; /** * Salt for the edit token. @@ -1089,7 +1090,7 @@ class HTMLForm extends ContextSource { # Include a
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( @@ -1534,6 +1535,19 @@ class HTMLForm extends ContextSource { 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 "
", with * this message as its "" element. diff --git a/includes/htmlform/OOUIHTMLForm.php b/includes/htmlform/OOUIHTMLForm.php index e7e3ff6333..738db0966b 100644 --- a/includes/htmlform/OOUIHTMLForm.php +++ b/includes/htmlform/OOUIHTMLForm.php @@ -284,7 +284,7 @@ class OOUIHTMLForm extends HTMLForm { 'content' => new OOUI\HtmlSnippet( $html ) ] ), ], - ] ); + ] + OOUI\Element::configFromHtmlAttributes( $this->mWrapperAttributes ) ); } else { $content = new OOUI\HtmlSnippet( $html ); } -- 2.20.1