messageLocalizer = $messageLocalizer; } /** * @inheritDoc */ public function getGroup( array $toolbox ): Group { $group = new Group(); $possibleEntries = array_filter( [ $this->build( 'info', 'infoFilled', 'info', $toolbox ), $this->build( 'permalink', 'link', 'permalink', $toolbox ), $this->build( 'backlinks', 'articleRedirect', 'whatlinkshere', $toolbox ), $this->build( 'wikibase', 'logoWikidata', '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' ), $this->messageLocalizer->msg( 'minerva-page-actions-' . $name ), $name ) : null; } }