messageLocalizer = $messageLocalizer; } /** * @inheritDoc */ public function getGroup( array $toolbox ): Group { $group = new Group( 'p-tb' ); $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 WikimediaUI icon name. * @param string $toolboxIdx * @param array $toolbox An array of common toolbox items from the sidebar menu * @return IMenuEntry|null */ private function build( $name, $icon, $toolboxIdx, array $toolbox ) { $href = $toolbox[$toolboxIdx]['href'] ?? null; return $href ? SingleMenuEntry::create( 'page-actions-overflow-' . $name, $this->messageLocalizer->msg( 'minerva-page-actions-' . $name )->text(), $href )->setIcon( $icon, 'before' ) ->trackClicks( $name ) : null; } }