toolbarBuilder = $toolbarBuilder; $this->overflowBuilder = $overflowBuilder; $this->messageLocalizer = $messageLocalizer; } /** * Build the menu data array that can be passed to views/javascript * @param array $toolbox An array of common toolbox items from the sidebar menu * @return array * @throws MWException */ public function buildMenu( array $toolbox ): array { $toolbar = $this->toolbarBuilder->getGroup(); $overflowMenu = $this->overflowBuilder->getGroup( $toolbox ); $menu = [ 'toolbar' => $toolbar->getEntries() ]; if ( $overflowMenu->hasEntries() ) { // See components/ToggleList. $menu[ 'overflowMenu' ] = [ 'item-id' => 'page-actions-overflow', 'checkboxID' => 'page-actions-overflow-checkbox', 'toggleID' => 'page-actions-overflow-toggle', 'toggleClass' => MinervaUI::iconClass( 'page-actions-overflow', 'element' ), 'listClass' => 'page-actions-overflow-list toggle-list__list--drop-down', 'text' => $this->messageLocalizer->msg( 'minerva-page-actions-overflow' ), 'analyticsEventName' => 'ui.overflowmenu', 'items' => $overflowMenu->getEntries() ]; } return $menu; } }