sidebarData = $sidebarData; $this->languageData = $languageData; $this->localizer = $localizer; if ( $user->isRegistered() ) { $this->optOut = new VectorComponentMainMenuActionOptOut( $skin ); $this->pinnableHeader = new VectorComponentPinnableHeader( $this->localizer, false, self::ID, null ); } if ( $shouldLanguageAlertBeInSidebar ) { $this->alert = new VectorComponentMainMenuActionLanguageSwitchAlert( $skin ); } } /** * @inheritDoc */ public function getTemplateData(): array { $action = $this->optOut; $alert = $this->alert; $pinnableHeader = $this->pinnableHeader; $portletsRest = []; foreach ( $this->sidebarData[ 'array-portlets-rest' ] as $data ) { $portletsRest[] = ( new VectorComponentMenu( $data ) )->getTemplateData(); } $firstPortlet = new VectorComponentMenu( $this->sidebarData['data-portlets-first'] ); $languageMenu = new VectorComponentMenu( $this->languageData ); return [ 'data-portlets-first' => $firstPortlet->getTemplateData(), 'array-portlets-rest' => $portletsRest, 'data-main-menu-action' => $action ? $action->getTemplateData() : null, // T295555 Add language switch alert message temporarily (to be removed). 'data-vector-language-switch-alert' => $alert ? $alert->getTemplateData() : null, 'data-pinnable-header' => $pinnableHeader ? $pinnableHeader->getTemplateData() : null, 'data-languages' => $languageMenu->getTemplateData(), ]; } }