mirror of
https://github.com/StarCitizenTools/mediawiki-skins-Citizen.git
synced 2024-12-18 17:22:29 +00:00
03da361b97
- Refactor existing template data-related partials into CitizenComponent components - Re-implement user menu header as UserInfo - Add description text for anon and temp user in UserMenu --------- Co-authored-by: github-actions <github-actions@users.noreply.github.com>
44 lines
1 KiB
PHP
44 lines
1 KiB
PHP
<?php
|
|
|
|
declare( strict_types=1 );
|
|
|
|
namespace MediaWiki\Skins\Citizen\Components;
|
|
|
|
/**
|
|
* CitizenComponentMainMenu component
|
|
*/
|
|
class CitizenComponentMainMenu implements CitizenComponent {
|
|
/** @var array */
|
|
private $sidebarData;
|
|
|
|
/**
|
|
* @param array $sidebarData
|
|
*/
|
|
public function __construct( array $sidebarData ) {
|
|
$this->sidebarData = $sidebarData;
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function getTemplateData(): array {
|
|
$portletsRest = [];
|
|
foreach ( $this->sidebarData[ 'array-portlets-rest' ] as $data ) {
|
|
/**
|
|
* Remove toolbox from main menu as we moved it to article tools
|
|
* TODO: Move handling to SkinCitizen.php after we convert pagetools to component
|
|
*/
|
|
if ( $data['id'] === 'p-tb' ) {
|
|
continue;
|
|
}
|
|
$portletsRest[] = ( new CitizenComponentMenu( $data ) )->getTemplateData();
|
|
}
|
|
$firstPortlet = new CitizenComponentMenu( $this->sidebarData['data-portlets-first'] );
|
|
|
|
return [
|
|
'data-portlets-first' => $firstPortlet->getTemplateData(),
|
|
'array-portlets-rest' => $portletsRest
|
|
];
|
|
}
|
|
}
|