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 Skin::buildPersonalUrls * @return string|null */ public function renderMenuData( array $personalTools ) { $group = $this->builder->getGroup( $personalTools ); $entries = $group->getEntries(); $templateParser = new TemplateParser( __DIR__ . '/../../Skins' ); $toggleID = 'minerva-user-menu-toggle'; $checkboxID = 'minerva-user-menu-checkbox'; return empty( $entries ) ? null : $templateParser->processTemplate( 'ToggleList', [ 'class' => 'minerva-user-menu', 'checkboxID' => $checkboxID, 'toggleID' => $toggleID, // See skin.mustache too. 'data-btn' => [ 'tag-name' => 'label', 'data-icon' => [ 'icon' => 'minerva-userAvatarOutline', ], 'classes' => 'toggle-list__toggle', 'array-attributes' => [ [ 'key' => 'id', 'value' => $toggleID, ], [ 'key' => 'for', 'value' => $checkboxID, ], [ 'key' => 'aria-hidden', 'value' => 'true' ], [ 'key' => 'data-event-name', 'value' => 'ui.usermenu', ], ], 'label' => $this->localizer->msg( 'minerva-user-menu-button' )->escaped(), ], 'listID' => $group->getId(), 'listClass' => 'minerva-user-menu-list toggle-list__list--drop-down', // See ToggleList/*.less. 'items' => $entries ] ); } }