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 [ [ 'text' => $this->customProfileLabel ?? $username, 'href' => $this->customProfileURL ?? Title::newFromText( $username, NS_USER )->getLocalURL(), 'class' => MinervaUI::iconClass( 'userAvatar-base20', 'before', 'primary-action', 'wikimedia' ), 'data-event-name' => 'menu.' . ( $this->profileTrackingCode ?? self::DEFAULT_PROFILE_TRACKING_CODE ) ] ]; } }