messageLocalizer = $messageLocalizer; } /** * @inheritDoc */ public function getGroup( array $toolbox ): Group { $group = new Group(); $possibleEntries = array_filter( [ $this->build( 'info', 'info', 'info', $toolbox ), $this->build( 'permalink', 'link', 'permalink', $toolbox ), $this->build( 'backlinks', 'articleRedirect', 'whatlinkshere', $toolbox ), $this->build( 'wikibase', 'logo-Wikidata', 'wikibase', $toolbox ), $this->build( 'cite', 'quotes', 'citethispage', $toolbox ) ] ); foreach ( $possibleEntries as $menuEntry ) { $group->insertEntry( $menuEntry ); } Hooks::run( 'MobileMenu', [ 'pageactions.overflow', &$group ] ); return $group; } /** * Build the single menu entry * * @param string $name * @param string $icon Wikimedia UI icon name. * @param string $toolboxIdx * @param array $toolbox An array of common toolbox items from the sidebar menu * @return PageActionMenuEntry|null */ private function build( $name, $icon, $toolboxIdx, array $toolbox ) { $href = $toolbox[$toolboxIdx]['href'] ?? null; return $href ? new PageActionMenuEntry( 'page-actions-overflow-' . $name, $href, MinervaUI::iconClass( '', 'before', 'wikimedia-ui-' . $icon . '-base20 toggle-list-item__anchor--menu' ), $this->messageLocalizer->msg( 'minerva-page-actions-' . $name ) ) : null; } }