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' ); $trackingKeyOverrides = [ 'mytalk' => 'userTalk', 'watchlist' => 'unStar', 'mycontris' => 'contributions', ]; foreach ( $personalTools as $key => $item ) { if ( in_array( $key, [ 'preferences', 'betafeatures', 'uploads' ] ) ) { continue; } // Special casing for userpage to support Extension:GrowthExperiments. // This can be removed when T291568 is resolved. if ( $key === 'userpage' ) { $entry = new ProfileMenuEntry( $this->user ); $entry->overrideProfileURL( $item['href'], $item['text'] ); $group->insertEntry( $entry ); continue; } $icon = $item['icon'] ?? null; if ( $icon ) { $entry = SingleMenuEntry::create( $key, $item['text'], $item['href'], $item['class'] ?? '', $icon ); // override tracking key where key mismatch if ( array_key_exists( $key, $trackingKeyOverrides ) ) { $entry->trackClicks( $trackingKeyOverrides[ $key ] ); } $group->insertEntry( $entry ); } } Hooks::run( 'MobileMenu', [ 'user', &$group ], '1.38' ); return $group; } }