Merge "Allow top-right search form target to be modifiable"
This commit is contained in:
commit
8a21504083
7 changed files with 24 additions and 11 deletions
|
|
@ -75,12 +75,7 @@ class MediaWiki {
|
|||
$title = $request->getVal( 'title' );
|
||||
$action = $request->getVal( 'action' );
|
||||
|
||||
if ( $request->getCheck( 'search' ) ) {
|
||||
// Compatibility with old search URLs which didn't use Special:Search
|
||||
// Just check for presence here, so blank requests still
|
||||
// show the search page when using ugly URLs (T10054).
|
||||
$ret = SpecialPage::getTitleFor( 'Search' );
|
||||
} elseif ( $curid ) {
|
||||
if ( $curid ) {
|
||||
// URLs like this are generated by RC, because rc_title isn't always accurate
|
||||
$ret = Title::newFromID( $curid );
|
||||
} else {
|
||||
|
|
@ -124,6 +119,13 @@ class MediaWiki {
|
|||
}
|
||||
}
|
||||
|
||||
if ( $ret === null && $request->getCheck( 'search' ) ) {
|
||||
// Compatibility with old search URLs which didn't use Special:Search
|
||||
// Just check for presence here, so blank requests still
|
||||
// show the search page when using ugly URLs (T10054).
|
||||
$ret = SpecialPage::getTitleFor( 'Search' );
|
||||
}
|
||||
|
||||
// Use the main page as default title if nothing else has been provided
|
||||
if ( $ret === null
|
||||
&& strval( $title ) === ''
|
||||
|
|
|
|||
|
|
@ -1389,7 +1389,7 @@ class DefaultPreferencesFactory implements PreferencesFactory {
|
|||
if ( $this->options->get( 'SearchMatchRedirectPreference' ) ) {
|
||||
$defaultPreferences['search-match-redirect'] = [
|
||||
'type' => 'toggle',
|
||||
'section' => 'searchoptions',
|
||||
'section' => 'searchoptions/searchmisc',
|
||||
'label-message' => 'search-match-redirect-label',
|
||||
'help-message' => 'search-match-redirect-help',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -67,6 +67,8 @@ abstract class Skin extends ContextSource {
|
|||
/** The current major version of the skin specification. */
|
||||
protected const VERSION_MAJOR = 1;
|
||||
|
||||
private $searchPageTitle = null;
|
||||
|
||||
/**
|
||||
* Get the current major version of Skin. This is used to manage changes
|
||||
* to underlying data and for providing support for older and new versions of code.
|
||||
|
|
@ -917,7 +919,7 @@ abstract class Skin extends ContextSource {
|
|||
protected function getSearchLink() {
|
||||
wfDeprecated( __METHOD__, '1.36' );
|
||||
|
||||
$searchPage = SpecialPage::getTitleFor( 'Search' );
|
||||
$searchPage = $this->getSearchPageTitle();
|
||||
return $searchPage->getLocalURL();
|
||||
}
|
||||
|
||||
|
|
@ -2671,4 +2673,11 @@ abstract class Skin extends ContextSource {
|
|||
return $data;
|
||||
}
|
||||
|
||||
protected function getSearchPageTitle() : Title {
|
||||
return $this->searchPageTitle ?? SpecialPage::getTitleFor( 'Search' );
|
||||
}
|
||||
|
||||
public function setSearchPageTitle( Title $title ) {
|
||||
$this->searchPageTitle = $title;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -368,7 +368,7 @@ class SkinMustache extends SkinTemplate {
|
|||
),
|
||||
'html-input' => $this->makeSearchInput( [ 'id' => 'searchInput' ] ),
|
||||
'msg-search' => $this->msg( 'search' )->text(),
|
||||
'page-title' => SpecialPage::getTitleFor( 'Search' )->getPrefixedDBkey(),
|
||||
'page-title' => $this->getSearchPageTitle()->getPrefixedDBkey(),
|
||||
];
|
||||
|
||||
return $props;
|
||||
|
|
|
|||
|
|
@ -297,10 +297,10 @@ class SkinTemplate extends Skin {
|
|||
$tpl->set( 'notspecialpage', !$title->isSpecialPage() );
|
||||
|
||||
// Deprecated since 1.36
|
||||
$searchLink = SpecialPage::getTitleFor( 'Search' )->getLocalURL();
|
||||
$searchLink = $this->getSearchPageTitle()->getLocalURL();
|
||||
$tpl->set( 'searchaction', $searchLink );
|
||||
|
||||
$tpl->set( 'searchtitle', SpecialPage::getTitleFor( 'Search' )->getPrefixedDBkey() );
|
||||
$tpl->set( 'searchtitle', $this->getSearchPageTitle()->getPrefixedDBkey() );
|
||||
$tpl->set( 'search', trim( $request->getVal( 'search' ) ) );
|
||||
$tpl->set( 'stylepath', $config->get( 'StylePath' ) );
|
||||
$tpl->set( 'articlepath', $config->get( 'ArticlePath' ) );
|
||||
|
|
|
|||
|
|
@ -1094,6 +1094,7 @@
|
|||
"prefs-setemail": "Set an email address",
|
||||
"prefs-email": "Email options",
|
||||
"prefs-rendering": "Appearance",
|
||||
"prefs-searchmisc": "General",
|
||||
"saveprefs": "Save",
|
||||
"restoreprefs": "Restore all default settings (in all sections)",
|
||||
"prefs-editing": "Editing",
|
||||
|
|
|
|||
|
|
@ -1316,6 +1316,7 @@
|
|||
"prefs-setemail": "Used as link title in [[Special:Preferences]], if the user has not set E-mail address yet.\n\nSee also:\n* {{msg-mw|prefs-help-email-required|help}}\n* {{msg-mw|prefs-help-email|help}}\n* {{msg-mw|prefs-help-email-others|help}}\n* {{msg-mw|prefs-changeemail|link title}}",
|
||||
"prefs-email": "Used as section name in [[Special:Preferences]].",
|
||||
"prefs-rendering": "Title of tab in [[Special:Preferences]].\n{{Identical|Appearance}}",
|
||||
"prefs-searchmisc": "Title of general search options section in search tab",
|
||||
"saveprefs": "Button for saving changes in the preferences page.\n\nSee also:\n* {{msg-mw|Saveprefs}}\n* {{msg-mw|Accesskey-preferences-save}}\n* {{msg-mw|Tooltip-preferences-save}}\n{{Identical|Save}}",
|
||||
"restoreprefs": "Used as link text in [[Special:Preferences]]. The link points to [[Special:Preferences/reset]] which shows the \"Restore all default settings\" form.\n\nAlso used as label for the Submit button in [[Special:Preferences/reset]].",
|
||||
"prefs-editing": "Title of a tab in [[Special:Preferences]].\nWhen changing this message, please also update {{msg-mw|vector-editwarning-warning}} which references to this message.\n{{Identical|Editing}}",
|
||||
|
|
|
|||
Loading…
Reference in a new issue