mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-24 07:43:47 +00:00
Merge "SearchBox: Fix data-search-loc attribute"
This commit is contained in:
commit
0b63179fb5
|
@ -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