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' ),
|
'html-navigation-heading' => $this->getMsg( 'navigation-heading' ),
|
||||||
'data-search-box' => $this->buildSearchProps(),
|
'data-search-box' => $this->buildSearchProps(),
|
||||||
'data-sidebar' => [
|
'data-sidebar' => $this->buildSidebar(),
|
||||||
'has-logo' => true,
|
|
||||||
'html-logo-attributes' => Xml::expandAttributes(
|
|
||||||
Linker::tooltipAndAccesskeyAttribs( 'p-logo' ) + [
|
|
||||||
'class' => 'mw-wiki-logo',
|
|
||||||
'href' => Skin::makeMainPageUrl(),
|
|
||||||
]
|
|
||||||
)
|
|
||||||
] + $this->buildSidebarProps( $this->get( 'sidebar', [] ) ),
|
|
||||||
] + $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
|
||||||
@ -276,10 +268,10 @@ class VectorTemplate extends BaseTemplate {
|
|||||||
/**
|
/**
|
||||||
* Render a series of portals
|
* Render a series of portals
|
||||||
*
|
*
|
||||||
* @param array $portals
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function buildSidebarProps( array $portals ) : array {
|
private function buildSidebar() : array {
|
||||||
|
$portals = $this->get( 'sidebar', [] );
|
||||||
$props = [];
|
$props = [];
|
||||||
// Force the rendering of the following portals
|
// Force the rendering of the following portals
|
||||||
if ( !isset( $portals['TOOLBOX'] ) ) {
|
if ( !isset( $portals['TOOLBOX'] ) ) {
|
||||||
@ -328,6 +320,13 @@ class VectorTemplate extends BaseTemplate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return [
|
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-rest' => array_slice( $props, 1 ),
|
||||||
'array-portals-first' => $firstPortal,
|
'array-portals-first' => $firstPortal,
|
||||||
];
|
];
|
||||||
|
Loading…
Reference in New Issue
Block a user