mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-24 15:53:46 +00:00
Add buildSidebar method
Move all the sidebar generation logic into a new VectorTemplate function. The name mirrors the function name in SkinVector. In future, ( I7a14f74728703c50874935e9d77b35ad9434b436) we will move this code into SkinVector where it will be able to call parent::buildSidebar() Bug: T251212 Change-Id: I0a4838120f6ffd3d3d798f876e3463a3f16af95b
This commit is contained in:
parent
a06ccff66f
commit
df681e031d
|
@ -189,15 +189,7 @@ class VectorTemplate extends BaseTemplate {
|
|||
],
|
||||
'html-navigation-heading' => $this->getMsg( 'navigation-heading' ),
|
||||
'data-search-box' => $this->buildSearchProps(),
|
||||
'data-sidebar' => [
|
||||
'has-logo' => true,
|
||||
'html-logo-attributes' => Xml::expandAttributes(
|
||||
Linker::tooltipAndAccesskeyAttribs( 'p-logo' ) + [
|
||||
'class' => 'mw-wiki-logo',
|
||||
'href' => Skin::makeMainPageUrl(),
|
||||
]
|
||||
)
|
||||
] + $this->buildSidebarProps( $this->get( 'sidebar', [] ) ),
|
||||
'data-sidebar' => $this->buildSidebar(),
|
||||
] + $this->getMenuProps();
|
||||
|
||||
// The following logic is unqiue to Vector (not used by legacy Vector) and
|
||||
|
@ -276,10 +268,10 @@ class VectorTemplate extends BaseTemplate {
|
|||
/**
|
||||
* Render a series of portals
|
||||
*
|
||||
* @param array $portals
|
||||
* @return array
|
||||
*/
|
||||
private function buildSidebarProps( array $portals ) : array {
|
||||
private function buildSidebar() : array {
|
||||
$portals = $this->get( 'sidebar', [] );
|
||||
$props = [];
|
||||
// Force the rendering of the following portals
|
||||
if ( !isset( $portals['TOOLBOX'] ) ) {
|
||||
|
@ -328,6 +320,13 @@ class VectorTemplate extends BaseTemplate {
|
|||
}
|
||||
|
||||
return [
|
||||
'has-logo' => true,
|
||||
'html-logo-attributes' => Xml::expandAttributes(
|
||||
Linker::tooltipAndAccesskeyAttribs( 'p-logo' ) + [
|
||||
'class' => 'mw-wiki-logo',
|
||||
'href' => Skin::makeMainPageUrl(),
|
||||
]
|
||||
),
|
||||
'array-portals-rest' => array_slice( $props, 1 ),
|
||||
'array-portals-first' => $firstPortal,
|
||||
];
|
||||
|
|
Loading…
Reference in a new issue