showMobileOptions = $showMobileOptions; $this->user = $user; $this->definitions = $definitions; } /** * @inheritDoc * @return Group[] * @throws FatalError * @throws MWException */ public function getGroups(): array { return [ BuilderUtil::getDiscoveryTools( $this->definitions ), $this->getPersonalTools(), $this->getSiteTools(), BuilderUtil::getConfigurationTools( $this->definitions, $this->showMobileOptions ), ]; } /** * @inheritDoc * @throws FatalError * @throws MWException */ public function getSiteLinks(): Group { return BuilderUtil::getSiteLinks( $this->definitions ); } /** * Builds the personal tools menu item group. * @return Group * @throws FatalError * @throws MWException */ private function getPersonalTools(): Group { $group = new Group(); $this->definitions->insertAuthMenuItem( $group ); if ( $this->user->isLoggedIn() ) { $this->definitions->insertWatchlistMenuItem( $group ); $this->definitions->insertContributionsMenuItem( $group ); } // Allow other extensions to add or override tools Hooks::run( 'MobileMenu', [ 'personal', &$group ] ); return $group; } /** * Prepares a list of links that have the purpose of discovery in the main navigation menu * @return Group * @throws FatalError * @throws MWException */ private function getSiteTools(): Group { $group = new Group(); $this->definitions->insertSpecialPages( $group ); $this->definitions->insertCommunityPortal( $group ); // Allow other extensions to add or override tools Hooks::run( 'MobileMenu', [ 'sitetools', &$group ] ); return $group; } }