$out->allowClickjacking();
$out->addModuleStyles( [
'mediawiki.special', 'mediawiki.special.search', 'mediawiki.ui', 'mediawiki.ui.button',
- 'mediawiki.ui.input',
+ 'mediawiki.ui.input', 'mediawiki.widgets.SearchInputWidget.styles',
] );
$this->addHelpLink( 'Help:Searching' );
# If there's an exact or very near match, jump right there.
$title = SearchEngine::getNearMatch( $term );
- if ( !is_null( $title ) ) {
- $this->getOutput()->redirect( $title->getFullURL() );
+ if ( !is_null( $title ) &&
+ Hooks::run( 'SpecialSearchGoResult', [ $term, $title, &$url ] )
+ ) {
+ if ( $url === null ) {
+ $url = $title->getFullURL();
+ }
+ $this->getOutput()->redirect( $url );
return;
}
}
// start rendering the page
- $out->addHtml(
+ $out->addHTML(
Xml::openElement(
'form',
[
$num = $titleMatchesNum + $textMatchesNum;
$totalRes = $numTitleMatches + $numTextMatches;
- $out->addHtml(
+ $out->enableOOUI();
+ $out->addHTML(
# This is an awful awful ID name. It's not a table, but we
# named it poorly from when this was a table so now we're
# stuck with it
return;
}
- $out->addHtml( "<div class='searchresults'>" );
+ $out->addHTML( "<div class='searchresults'>" );
// prev/next links
$prevnext = null;
$out->addHTML( "<p class='mw-search-pager-bottom'>{$prevnext}</p>\n" );
}
- $out->addHtml( "</div>" );
+ $out->addHTML( "</div>" );
Hooks::run( 'SpecialSearchResultsAppend', [ $this, $out, $term ] );
) {
// invalid title
// preserve the paragraph for margins etc...
- $this->getOutput()->addHtml( '<p></p>' );
+ $this->getOutput()->addHTML( '<p></p>' );
return;
}
$this->getOutput()->wrapWikiMsg( "<p class=\"$linkClass\">\n$1</p>", $params );
} else {
// preserve the paragraph for margins etc...
- $this->getOutput()->addHtml( '<p></p>' );
+ $this->getOutput()->addHTML( '<p></p>' );
}
}
* @return string
*/
protected function shortDialog( $term, $resultsShown, $totalNum ) {
- $out = Html::hidden( 'title', $this->getPageTitle()->getPrefixedText() );
- $out .= Html::hidden( 'profile', $this->profile ) . "\n";
- // Term box
- $out .= Html::input( 'search', $term, 'search', [
- 'id' => $this->isPowerSearch() ? 'powerSearchText' : 'searchText',
- 'size' => '50',
+ $searchWidget = new MediaWiki\Widget\SearchInputWidget( [
+ 'id' => 'searchText',
+ 'name' => 'search',
'autofocus' => trim( $term ) === '',
- 'class' => 'mw-ui-input mw-ui-input-inline',
- ] ) . "\n";
- $out .= Html::hidden( 'fulltext', 'Search' ) . "\n";
- $out .= Html::submitButton(
- $this->msg( 'searchbutton' )->text(),
- [ 'class' => 'mw-ui-button mw-ui-progressive' ],
- [ 'mw-ui-progressive' ]
- ) . "\n";
+ 'value' => $term,
+ ] );
+
+ $out =
+ Html::hidden( 'title', $this->getPageTitle()->getPrefixedText() ) .
+ Html::hidden( 'profile', $this->profile ) .
+ Html::hidden( 'fulltext', 'Search' ) .
+ $searchWidget .
+ new OOUI\ButtonInputWidget( [
+ 'type' => 'submit',
+ 'label' => $this->msg( 'searchbutton' )->text(),
+ 'flags' => [ 'progressive', 'primary' ],
+ ] );
// Results-info
if ( $totalNum > 0 && $this->offset < $totalNum ) {