sidebarData = $sidebarData; $this->languageData = $languageData; $this->localizer = $localizer; $this->isPinned = $featureManager->isFeatureEnabled( Constants::FEATURE_MAIN_MENU_PINNED ); $this->pinnableHeader = new VectorComponentPinnableHeader( $this->localizer, $this->isPinned, self::ID, 'main-menu-pinned' ); if ( $user->isRegistered() ) { $this->optOut = new VectorComponentMainMenuActionOptOut( $skin ); } } /** * @inheritDoc */ public function getTemplateData(): array { $action = $this->optOut; $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 ); $pinnableContainer = new VectorComponentPinnableContainer( self::ID, $this->isPinned ); $pinnableElement = new VectorComponentPinnableElement( self::ID ); return $pinnableElement->getTemplateData() + $pinnableContainer->getTemplateData() + [ 'data-portlets-first' => $firstPortlet->getTemplateData(), 'array-portlets-rest' => $portletsRest, 'data-main-menu-action' => $action ? $action->getTemplateData() : null, 'data-pinnable-header' => $pinnableHeader ? $pinnableHeader->getTemplateData() : null, 'data-languages' => $languageMenu->getTemplateData(), ]; } }