mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-12-01 02:37:05 +00:00
Merge "Use consistent function names to SkinVector"
This commit is contained in:
commit
48b680744d
|
@ -78,6 +78,23 @@ class VectorTemplate extends BaseTemplate {
|
||||||
$this->templateRoot = $isLegacy ? 'legacy' : 'index';
|
$this->templateRoot = $isLegacy ? 'legacy' : 'index';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
private function getConfig() {
|
||||||
|
return $this->config;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The template parser might be undefined. This function will check if it set first
|
* The template parser might be undefined. This function will check if it set first
|
||||||
*
|
*
|
||||||
|
@ -100,7 +117,7 @@ class VectorTemplate extends BaseTemplate {
|
||||||
$contentNavigation = $this->get( 'content_navigation', [] );
|
$contentNavigation = $this->get( 'content_navigation', [] );
|
||||||
|
|
||||||
// Move the watch/unwatch star outside of the collapsed "actions" menu to the main "views" menu
|
// Move the watch/unwatch star outside of the collapsed "actions" menu to the main "views" menu
|
||||||
if ( $this->config->get( 'VectorUseIconWatch' ) ) {
|
if ( $this->getConfig()->get( 'VectorUseIconWatch' ) ) {
|
||||||
$mode = ( $this->getSkin()->getRelevantTitle()->isWatchable() &&
|
$mode = ( $this->getSkin()->getRelevantTitle()->isWatchable() &&
|
||||||
MediaWikiServices::getInstance()->getPermissionManager()->userHasRight(
|
MediaWikiServices::getInstance()->getPermissionManager()->userHasRight(
|
||||||
$this->getSkin()->getUser(),
|
$this->getSkin()->getUser(),
|
||||||
|
@ -157,7 +174,7 @@ class VectorTemplate extends BaseTemplate {
|
||||||
'html-title' => $this->get( 'title', '' ),
|
'html-title' => $this->get( 'title', '' ),
|
||||||
|
|
||||||
'html-prebodyhtml' => $this->get( 'prebodyhtml', '' ),
|
'html-prebodyhtml' => $this->get( 'prebodyhtml', '' ),
|
||||||
'msg-tagline' => $this->getMsg( 'tagline' )->text(),
|
'msg-tagline' => $this->msg( 'tagline' )->text(),
|
||||||
// TODO: mediawiki/SkinTemplate should expose langCode and langDir properly.
|
// TODO: mediawiki/SkinTemplate should expose langCode and langDir properly.
|
||||||
'html-userlangattributes' => $this->get( 'userlangattributes', '' ),
|
'html-userlangattributes' => $this->get( 'userlangattributes', '' ),
|
||||||
// From OutputPage::getSubtitle()
|
// From OutputPage::getSubtitle()
|
||||||
|
@ -170,8 +187,8 @@ class VectorTemplate extends BaseTemplate {
|
||||||
// From Skin::getNewtalks(). Always returns string, cast to null if empty.
|
// From Skin::getNewtalks(). Always returns string, cast to null if empty.
|
||||||
'html-newtalk' => $this->get( 'newtalk', '' ) ?: null,
|
'html-newtalk' => $this->get( 'newtalk', '' ) ?: null,
|
||||||
|
|
||||||
'msg-jumptonavigation' => $this->getMsg( 'vector-jumptonavigation' )->text(),
|
'msg-jumptonavigation' => $this->msg( 'vector-jumptonavigation' )->text(),
|
||||||
'msg-jumptosearch' => $this->getMsg( 'vector-jumptosearch' )->text(),
|
'msg-jumptosearch' => $this->msg( 'vector-jumptosearch' )->text(),
|
||||||
|
|
||||||
// Result of OutputPage::addHTML calls
|
// Result of OutputPage::addHTML calls
|
||||||
'html-bodycontent' => $this->get( 'bodycontent' ),
|
'html-bodycontent' => $this->get( 'bodycontent' ),
|
||||||
|
@ -188,7 +205,7 @@ class VectorTemplate extends BaseTemplate {
|
||||||
'html-hook-vector-before-footer' => $htmlHookVectorBeforeFooter,
|
'html-hook-vector-before-footer' => $htmlHookVectorBeforeFooter,
|
||||||
'array-footer-rows' => $this->getTemplateFooterRows(),
|
'array-footer-rows' => $this->getTemplateFooterRows(),
|
||||||
],
|
],
|
||||||
'html-navigation-heading' => $this->getMsg( 'navigation-heading' ),
|
'html-navigation-heading' => $this->msg( 'navigation-heading' ),
|
||||||
'data-search-box' => $this->buildSearchProps(),
|
'data-search-box' => $this->buildSearchProps(),
|
||||||
|
|
||||||
// Header
|
// Header
|
||||||
|
@ -209,7 +226,7 @@ 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->getMsg( 'vector-opt-out' )->text()
|
'text' => $this->msg( 'vector-opt-out' )->text()
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,7 +410,7 @@ class VectorTemplate extends BaseTemplate {
|
||||||
public function makeListItem( $key, $item, $options = [] ) {
|
public function makeListItem( $key, $item, $options = [] ) {
|
||||||
// For fancy styling of watch/unwatch star
|
// For fancy styling of watch/unwatch star
|
||||||
if (
|
if (
|
||||||
$this->config->get( 'VectorUseIconWatch' )
|
$this->getConfig()->get( 'VectorUseIconWatch' )
|
||||||
&& ( $key === 'watch' || $key === 'unwatch' )
|
&& ( $key === 'watch' || $key === 'unwatch' )
|
||||||
) {
|
) {
|
||||||
if ( !isset( $item['class'] ) ) {
|
if ( !isset( $item['class'] ) ) {
|
||||||
|
@ -445,7 +462,7 @@ class VectorTemplate extends BaseTemplate {
|
||||||
'label-id' => "p-{$label}-label",
|
'label-id' => "p-{$label}-label",
|
||||||
// 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
|
||||||
'label' => $this->getMsg( self::MENU_LABEL_KEYS[ $label ] ?? $label )->text(),
|
'label' => $this->msg( self::MENU_LABEL_KEYS[ $label ] ?? $label )->text(),
|
||||||
'html-userlangattributes' => $this->get( 'userlangattributes', '' ),
|
'html-userlangattributes' => $this->get( 'userlangattributes', '' ),
|
||||||
'html-items' => '',
|
'html-items' => '',
|
||||||
];
|
];
|
||||||
|
@ -481,7 +498,7 @@ class VectorTemplate extends BaseTemplate {
|
||||||
$loggedIn =
|
$loggedIn =
|
||||||
Html::element( 'li',
|
Html::element( 'li',
|
||||||
[ 'id' => 'pt-anonuserpage' ],
|
[ 'id' => 'pt-anonuserpage' ],
|
||||||
$this->getMsg( 'notloggedin' )->text()
|
$this->msg( 'notloggedin' )->text()
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$loggedIn = '';
|
$loggedIn = '';
|
||||||
|
@ -535,7 +552,7 @@ class VectorTemplate extends BaseTemplate {
|
||||||
$props = [
|
$props = [
|
||||||
'searchHeaderAttrsHTML' => $this->get( 'userlangattributes', '' ),
|
'searchHeaderAttrsHTML' => $this->get( 'userlangattributes', '' ),
|
||||||
'searchActionURL' => $this->get( 'wgScript', '' ),
|
'searchActionURL' => $this->get( 'wgScript', '' ),
|
||||||
'searchDivID' => $this->config->get( 'VectorUseSimpleSearch' ) ? 'simpleSearch' : '',
|
'searchDivID' => $this->getConfig()->get( 'VectorUseSimpleSearch' ) ? 'simpleSearch' : '',
|
||||||
'searchInputHTML' => $this->makeSearchInput( [ 'id' => 'searchInput' ] ),
|
'searchInputHTML' => $this->makeSearchInput( [ 'id' => 'searchInput' ] ),
|
||||||
'titleHTML' => Html::hidden( 'title', $this->get( 'searchtitle', null ) ),
|
'titleHTML' => Html::hidden( 'title', $this->get( 'searchtitle', null ) ),
|
||||||
'fallbackSearchButtonHTML' => $this->makeSearchButton(
|
'fallbackSearchButtonHTML' => $this->makeSearchButton(
|
||||||
|
@ -546,7 +563,7 @@ class VectorTemplate extends BaseTemplate {
|
||||||
'go',
|
'go',
|
||||||
[ 'id' => 'searchButton', 'class' => 'searchButton' ]
|
[ 'id' => 'searchButton', 'class' => 'searchButton' ]
|
||||||
),
|
),
|
||||||
'searchInputLabel' => $this->getMsg( 'search' )
|
'searchInputLabel' => $this->msg( 'search' )
|
||||||
];
|
];
|
||||||
return $props;
|
return $props;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue