builder = $builder; $this->localizer = $localizer; } /** * Build the menu data array that can be passed to views/javascript * @param array $personalTools Personal tools list generated by BaseTemplate::getPersonalTools * @return string|null */ public function renderMenuData( array $personalTools ) { $group = $this->builder->getGroup( $personalTools ); $entries = $group->getEntries(); $templateParser = new TemplateParser( __DIR__ . '/../../../components' ); return empty( $entries ) ? null : $templateParser->processTemplate( 'ToggleList', [ 'class' => 'minerva-user-menu', 'checkboxID' => 'minerva-user-menu-checkbox', 'toggleID' => 'minerva-user-menu-toggle', // See skin.mustache too. 'toggleClass' => MinervaUI::iconClass( 'userAvatarOutline', 'element' ), 'listID' => $group->getId(), 'listClass' => 'minerva-user-menu-list toggle-list__list--drop-down', // See ToggleList/*.less. 'text' => $this->localizer->msg( 'minerva-user-menu-button' )->escaped(), 'analyticsEventName' => 'ui.usermenu', 'items' => $entries ] ); } }