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( 'profile', 'before', 'truncated-text primary-action' ), 'data-event-name' => $this->profileTrackingCode ?? self::DEFAULT_PROFILE_TRACKING_CODE ] ]; } }