user = $user; } /** * @inheritDoc */ public function getName() { return 'profile'; } /** * @inheritDoc */ public function overrideProfileURL( $customURL, $customLabel = null, $trackingCode = null ) { $this->customProfileURL = $customURL; $this->customProfileLabel = $customLabel; $this->profileTrackingCode = $trackingCode; return $this; } /** * @inheritDoc */ public function getCSSClasses(): array { return []; } /** * @inheritDoc */ public function getComponents(): array { $username = $this->user->getName(); return [ [ 'icon' => 'wikimedia-userAvatar-base20', 'text' => $this->customProfileLabel ?? $username, 'href' => $this->customProfileURL ?? Title::makeTitle( NS_USER, $username )->getLocalURL(), 'class' => 'menu__item--user', 'data-event-name' => 'menu.' . ( $this->profileTrackingCode ?? self::DEFAULT_PROFILE_TRACKING_CODE ) ] ]; } }