messageLocalizer = $messageLocalizer; $this->user = $user; $this->definitions = $definitions; } /** * @inheritDoc * @param array $personalTools list of personal tools generated by * SkinTemplate::getPersonalTools * @return Group */ public function getGroup( array $personalTools ): Group { $group = new Group( 'p-personal' ); $group->insertEntry( new ProfileMenuEntry( $this->user ) ); $talkPage = $this->user->getUserPage()->getTalkPageIfDefined(); if ( $talkPage ) { $group->insertEntry( new SingleMenuEntry( 'userTalk', $this->messageLocalizer->msg( 'mobile-frontend-user-page-talk' )->escaped(), $talkPage->getLocalURL(), true, null, 'before', 'wikimedia-ui-userTalk-base20' ) ); } $sandbox = $personalTools['sandbox']['links'][0] ?? false; if ( $sandbox ) { $group->insertEntry( new SingleMenuEntry( 'userSandbox', $sandbox['text'], $sandbox['href'] ) ); } $this->definitions->insertWatchlistMenuItem( $group ); $this->definitions->insertContributionsMenuItem( $group ); if ( $this->user->isAnon() ) { $this->definitions->insertLogInMenuItem( $group ); } else { $this->definitions->insertLogOutMenuItem( $group ); } Hooks::run( 'MobileMenu', [ 'user', &$group ] ); return $group; } }