Merge "VectorTemplate: use skin->Msg() instead of msg()"
This commit is contained in:
commit
6a078bc246
|
@ -81,16 +81,6 @@ class VectorTemplate extends BaseTemplate {
|
||||||
$this->templateRoot = $isLegacy ? 'skin-legacy' : 'skin';
|
$this->templateRoot = $isLegacy ? 'skin-legacy' : 'skin';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Amends the default behavior of BaseTemplate to return rather
|
|
||||||
* than echo.
|
|
||||||
* @param string $key
|
|
||||||
* @return Message
|
|
||||||
*/
|
|
||||||
public function msg( $key ) {
|
|
||||||
return $this->getMsg( $key );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Config
|
* @return Config
|
||||||
*/
|
*/
|
||||||
|
@ -150,29 +140,29 @@ class VectorTemplate extends BaseTemplate {
|
||||||
// Remember that the string '0' is a valid title.
|
// Remember that the string '0' is a valid title.
|
||||||
// From OutputPage::getPageTitle, via ::setPageTitle().
|
// From OutputPage::getPageTitle, via ::setPageTitle().
|
||||||
'html-title' => $out->getPageTitle(),
|
'html-title' => $out->getPageTitle(),
|
||||||
'msg-tagline' => $this->msg( 'tagline' )->text(),
|
'msg-tagline' => $skin->msg( 'tagline' )->text(),
|
||||||
|
|
||||||
// From Skin::getNewtalks(). Always returns string, cast to null if empty.
|
// From Skin::getNewtalks(). Always returns string, cast to null if empty.
|
||||||
'html-newtalk' => $skin->getNewtalks() ?: null,
|
'html-newtalk' => $skin->getNewtalks() ?: null,
|
||||||
|
|
||||||
'msg-vector-jumptonavigation' => $this->msg( 'vector-jumptonavigation' )->text(),
|
'msg-vector-jumptonavigation' => $skin->msg( 'vector-jumptonavigation' )->text(),
|
||||||
'msg-vector-jumptosearch' => $this->msg( 'vector-jumptosearch' )->text(),
|
'msg-vector-jumptosearch' => $skin->msg( 'vector-jumptosearch' )->text(),
|
||||||
|
|
||||||
'html-printfooter' => $skin->printSource(),
|
'html-printfooter' => $skin->printSource(),
|
||||||
'html-catlinks' => $skin->getCategories(),
|
'html-catlinks' => $skin->getCategories(),
|
||||||
'data-footer' => $this->getFooterData(),
|
'data-footer' => $this->getFooterData(),
|
||||||
'html-navigation-heading' => $this->msg( 'navigation-heading' ),
|
'html-navigation-heading' => $skin->msg( 'navigation-heading' ),
|
||||||
'data-search-box' => $this->buildSearchProps(),
|
'data-search-box' => $this->buildSearchProps(),
|
||||||
|
|
||||||
// Header
|
// Header
|
||||||
'data-logos' => ResourceLoaderSkinModule::getAvailableLogos( $this->getConfig() ),
|
'data-logos' => ResourceLoaderSkinModule::getAvailableLogos( $this->getConfig() ),
|
||||||
'msg-sitetitle' => $this->msg( 'sitetitle' )->text(),
|
'msg-sitetitle' => $skin->msg( 'sitetitle' )->text(),
|
||||||
'msg-sitesubtitle' => $this->msg( 'sitesubtitle' )->text(),
|
'msg-sitesubtitle' => $skin->msg( 'sitesubtitle' )->text(),
|
||||||
'main-page-href' => $mainPageHref,
|
'main-page-href' => $mainPageHref,
|
||||||
|
|
||||||
'data-sidebar' => $this->buildSidebar(),
|
'data-sidebar' => $this->buildSidebar(),
|
||||||
'sidebar-visible' => $this->isSidebarVisible(),
|
'sidebar-visible' => $this->isSidebarVisible(),
|
||||||
'msg-vector-action-toggle-sidebar' => $this->msg( 'vector-action-toggle-sidebar' )->text(),
|
'msg-vector-action-toggle-sidebar' => $skin->msg( 'vector-action-toggle-sidebar' )->text(),
|
||||||
] + $this->getMenuProps();
|
] + $this->getMenuProps();
|
||||||
|
|
||||||
// The following logic is unqiue to Vector (not used by legacy Vector) and
|
// The following logic is unqiue to Vector (not used by legacy Vector) and
|
||||||
|
@ -184,8 +174,8 @@ class VectorTemplate extends BaseTemplate {
|
||||||
false,
|
false,
|
||||||
'mw-prefsection-rendering-skin-skin-prefs'
|
'mw-prefsection-rendering-skin-skin-prefs'
|
||||||
)->getLinkURL( 'wprov=' . self::OPT_OUT_LINK_TRACKING_CODE ),
|
)->getLinkURL( 'wprov=' . self::OPT_OUT_LINK_TRACKING_CODE ),
|
||||||
'text' => $this->msg( 'vector-opt-out' )->text(),
|
'text' => $skin->msg( 'vector-opt-out' )->text(),
|
||||||
'title' => $this->msg( 'vector-opt-out-tooltip' )->text(),
|
'title' => $skin->msg( 'vector-opt-out-tooltip' )->text(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,6 +388,7 @@ class VectorTemplate extends BaseTemplate {
|
||||||
array $options = [],
|
array $options = [],
|
||||||
bool $setLabelToSelected = false
|
bool $setLabelToSelected = false
|
||||||
) : array {
|
) : array {
|
||||||
|
$skin = $this->getSkin();
|
||||||
$extraClasses = [
|
$extraClasses = [
|
||||||
self::MENU_TYPE_DROPDOWN => 'vector-menu vector-menu-dropdown vectorMenu',
|
self::MENU_TYPE_DROPDOWN => 'vector-menu vector-menu-dropdown vectorMenu',
|
||||||
self::MENU_TYPE_TABS => 'vector-menu vector-menu-tabs vectorTabs',
|
self::MENU_TYPE_TABS => 'vector-menu vector-menu-tabs vectorTabs',
|
||||||
|
@ -414,7 +405,7 @@ class VectorTemplate extends BaseTemplate {
|
||||||
|
|
||||||
// For some menu items, there is no language key corresponding with its menu key.
|
// For some menu items, there is no language key corresponding with its menu key.
|
||||||
// These inconsitencies are captured in MENU_LABEL_KEYS
|
// These inconsitencies are captured in MENU_LABEL_KEYS
|
||||||
$msgObj = $this->msg( self::MENU_LABEL_KEYS[ $label ] ?? $label );
|
$msgObj = $skin->msg( self::MENU_LABEL_KEYS[ $label ] ?? $label );
|
||||||
$props = [
|
$props = [
|
||||||
'id' => "p-$label",
|
'id' => "p-$label",
|
||||||
'label-id' => "p-{$label}-label",
|
'label-id' => "p-{$label}-label",
|
||||||
|
@ -474,7 +465,7 @@ class VectorTemplate extends BaseTemplate {
|
||||||
$loggedIn =
|
$loggedIn =
|
||||||
Html::element( 'li',
|
Html::element( 'li',
|
||||||
[ 'id' => 'pt-anonuserpage' ],
|
[ 'id' => 'pt-anonuserpage' ],
|
||||||
$this->msg( 'notloggedin' )->text()
|
$skin->msg( 'notloggedin' )->text()
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$loggedIn = '';
|
$loggedIn = '';
|
||||||
|
@ -526,6 +517,7 @@ class VectorTemplate extends BaseTemplate {
|
||||||
*/
|
*/
|
||||||
private function buildSearchProps() : array {
|
private function buildSearchProps() : array {
|
||||||
$config = $this->getConfig();
|
$config = $this->getConfig();
|
||||||
|
$skin = $this->getSkin();
|
||||||
$props = [
|
$props = [
|
||||||
'form-action' => $config->get( 'Script' ),
|
'form-action' => $config->get( 'Script' ),
|
||||||
'html-button-search-fallback' => $this->makeSearchButton(
|
'html-button-search-fallback' => $this->makeSearchButton(
|
||||||
|
@ -537,7 +529,7 @@ class VectorTemplate extends BaseTemplate {
|
||||||
[ 'id' => 'searchButton', 'class' => 'searchButton' ]
|
[ 'id' => 'searchButton', 'class' => 'searchButton' ]
|
||||||
),
|
),
|
||||||
'html-input' => $this->makeSearchInput( [ 'id' => 'searchInput' ] ),
|
'html-input' => $this->makeSearchInput( [ 'id' => 'searchInput' ] ),
|
||||||
'msg-search' => $this->msg( 'search' ),
|
'msg-search' => $skin->msg( 'search' ),
|
||||||
'page-title' => SpecialPage::getTitleFor( 'Search' )->getPrefixedDBkey(),
|
'page-title' => SpecialPage::getTitleFor( 'Search' )->getPrefixedDBkey(),
|
||||||
];
|
];
|
||||||
return $props;
|
return $props;
|
||||||
|
|
Loading…
Reference in New Issue