refactor(core): ♻️ rename sidebar data to main menu

This commit is contained in:
alistair3149 2024-05-08 16:47:46 -04:00
parent 049366aaa9
commit ce5532eb8c
No known key found for this signature in database
3 changed files with 10 additions and 10 deletions

View file

@ -38,23 +38,23 @@ use NumberFormatter;
*/ */
final class Drawer extends Partial { final class Drawer extends Partial {
/** /**
* Decorate sidebar template data * Decorate main menu template data
* *
* @return array * @return array
*/ */
public function decorateSidebarData( $sidebarData ) { public function decorateMainMenuData( $mainMenuData ) {
for ( $i = 0; $i < count( $sidebarData['array-portlets-rest'] ); $i++ ) { for ( $i = 0; $i < count( $mainMenuData['array-portlets-rest'] ); $i++ ) {
if ( $sidebarData['array-portlets-rest'][$i]['id'] === 'p-tb' ) { if ( $mainMenuData['array-portlets-rest'][$i]['id'] === 'p-tb' ) {
// Remove toolbox since it is handled by page tools // Remove toolbox since it is handled by page tools
unset( $sidebarData['array-portlets-rest'][$i] ); unset( $mainMenuData['array-portlets-rest'][$i] );
break; break;
} }
} }
// Reset index after unsetting toolbox // Reset index after unsetting toolbox
$sidebarData['array-portlets-rest'] = array_values( $sidebarData['array-portlets-rest'] ); $mainMenuData['array-portlets-rest'] = array_values( $mainMenuData['array-portlets-rest'] );
return $sidebarData; return $mainMenuData;
} }
/** /**

View file

@ -116,7 +116,7 @@ class SkinCitizen extends SkinMustache {
'msg-citizen-footer-tagline' => $this->msg( "citizen-footer-tagline" )->inContentLanguage()->parse(), 'msg-citizen-footer-tagline' => $this->msg( "citizen-footer-tagline" )->inContentLanguage()->parse(),
// Decorate data provided by core // Decorate data provided by core
'data-search-box' => $header->decorateSearchBoxData( $parentData['data-search-box'] ), 'data-search-box' => $header->decorateSearchBoxData( $parentData['data-search-box'] ),
'data-portlets-sidebar' => $drawer->decorateSidebarData( $parentData['data-portlets-sidebar'] ), 'data-main-menu' => $drawer->decorateMainMenuData( $parentData['data-portlets-sidebar'] ),
'data-footer' => $footer->decorateFooterData( $parentData['data-footer'] ), 'data-footer' => $footer->decorateFooterData( $parentData['data-footer'] ),
]; ];

View file

@ -20,11 +20,11 @@
<div class="mw-logo-wordmark">{{msg-sitetitle}}</div> <div class="mw-logo-wordmark">{{msg-sitetitle}}</div>
</div> </div>
</header> </header>
{{#data-portlets-sidebar}} {{#data-main-menu}}
<section class="citizen-drawer__menu"> <section class="citizen-drawer__menu">
{{#data-portlets-first}}{{>Menu}}{{/data-portlets-first}} {{#data-portlets-first}}{{>Menu}}{{/data-portlets-first}}
{{#array-portlets-rest}}{{>Menu}}{{/array-portlets-rest}} {{#array-portlets-rest}}{{>Menu}}{{/array-portlets-rest}}
</section> </section>
{{/data-portlets-sidebar}} {{/data-main-menu}}
</aside> </aside>
</div> </div>