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 * @param array $actions An array of actions usually bucketed under the more menu * @return array */ public function buildMenu( array $toolbox, array $actions ): array { $toolbar = $this->toolbarBuilder->getGroup(); $overflowMenu = $this->overflowBuilder->getGroup( $toolbox, $actions ); $menu = [ 'toolbar' => $toolbar->getEntries() ]; if ( $overflowMenu->hasEntries() ) { // See includes/Skins/ToggleList. $toggleID = 'page-actions-overflow-toggle'; $checkboxID = 'page-actions-overflow-checkbox'; $menu[ 'overflowMenu' ] = [ 'item-id' => 'page-actions-overflow', 'checkboxID' => $checkboxID, 'toggleID' => $toggleID, 'data-btn' => [ 'tag-name' => 'label', 'data-icon' => [ 'icon' => 'minerva-ellipsis', ], 'classes' => 'toggle-list__toggle mw-ui-icon-with-label-desktop', 'array-attributes' => [ [ 'key' => 'id', 'value' => $toggleID, ], [ 'key' => 'for', 'value' => $checkboxID, ], [ 'key' => 'aria-hidden', 'value' => 'true' ], [ 'key' => 'data-event-name', 'value' => 'ui.overflowmenu', ], ], // class = toggle-list__toggle {{toggleClass}} // data-event-name="{{analyticsEventName}}"> 'label' => $this->messageLocalizer->msg( 'minerva-page-actions-overflow' ), ], 'listID' => $overflowMenu->getId(), 'listClass' => 'page-actions-overflow-list toggle-list__list--drop-down', 'items' => $overflowMenu->getEntries() ]; } return $menu; } }