mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-28 01:20:07 +00:00
SearchBox: Fix data-search-loc attribute
Following on from I0edbd89, set the data-search-loc attribute to "header-navigation" for legacy Vector. Bug: T256100 Change-Id: I113c56ac9b18df46ebc13b9985aea03ba82419bd
This commit is contained in:
parent
e7c07665ff
commit
58c1c9ddf5
|
@ -128,9 +128,6 @@ class SkinVector extends SkinMustache {
|
|||
$newTalksHtml = $skin->getNewtalks() ?: null;
|
||||
|
||||
$isSearchInHeader = $featureManager->isFeatureEnabled( Constants::FEATURE_SEARCH_IN_HEADER );
|
||||
$inputLocation = $isSearchInHeader
|
||||
? Constants::SEARCH_BOX_INPUT_LOCATION_MOVED
|
||||
: Constants::SEARCH_BOX_INPUT_LOCATION_DEFAULT;
|
||||
|
||||
$commonSkinData = parent::getTemplateData() + [
|
||||
'page-langcode' => $title->getPageViewLanguage()->getHtmlCode(),
|
||||
|
@ -145,7 +142,7 @@ class SkinVector extends SkinMustache {
|
|||
'data-footer' => $this->getFooterData(),
|
||||
|
||||
'is-search-in-header' => $isSearchInHeader,
|
||||
'input-location' => $inputLocation,
|
||||
'input-location' => $this->getSearchBoxInputLocation( $isSearchInHeader ),
|
||||
|
||||
'main-page-href' => $mainPageHref,
|
||||
|
||||
|
@ -167,6 +164,23 @@ class SkinVector extends SkinMustache {
|
|||
return $commonSkinData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the "input-location" parameter for the SearchBox Mustache template.
|
||||
*
|
||||
* @param bool $isSearchInHeader
|
||||
* @return string Either `Constants::SEARCH_BOX_INPUT_LOCATION_DEFAULT` or
|
||||
* `Constants::SEARCH_BOX_INPUT_LOCATION_MOVED`
|
||||
*/
|
||||
private function getSearchBoxInputLocation( bool $isSearchInHeader ) : string {
|
||||
if ( $this->isLegacy() ) {
|
||||
return Constants::SEARCH_BOX_INPUT_LOCATION_DEFAULT;
|
||||
}
|
||||
|
||||
return $isSearchInHeader
|
||||
? Constants::SEARCH_BOX_INPUT_LOCATION_MOVED
|
||||
: Constants::SEARCH_BOX_INPUT_LOCATION_DEFAULT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get rows that make up the footer
|
||||
* @return array for use in Mustache template describing the footer elements.
|
||||
|
|
Loading…
Reference in a new issue