106 if ( $format !==
'wiki' && $format !==
'html' ) {
107 throw new InvalidArgumentException(
'UserGroupMembership::getLink() $format parameter should be ' .
108 "'wiki' or 'html'" );
112 $expiry = $ugm->getExpiry();
113 $group = $ugm->getGroup();
120 if ( $userName !==
null ) {
121 $groupName = $uiLanguage->getGroupMemberName( $group, $userName );
123 $groupName = $uiLanguage->getGroupName( $group );
127 $linkTitle = self::getGroupPage( $group );
128 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
129 if ( $format ===
'wiki' ) {
131 $linkPage = $linkTitle->getFullText();
132 $groupLink =
"[[$linkPage|$groupName]]";
134 $groupLink = $groupName;
138 $groupLink = $linkRenderer->makeLink( $linkTitle, $groupName );
140 $groupLink = htmlspecialchars( $groupName );
147 $expiryDT = $uiLanguage->userTimeAndDate( $expiry, $uiUser );
148 $expiryD = $uiLanguage->userDate( $expiry, $uiUser );
149 $expiryT = $uiLanguage->userTime( $expiry, $uiUser );
151 if ( $format ===
'wiki' ) {
152 return $context->
msg(
'group-membership-link-with-expiry' )
153 ->params( $groupLink, $expiryDT, $expiryD, $expiryT )->text();
157 return $context->
msg(
'group-membership-link-with-expiry' )
158 ->params( $groupLink, $expiryDT, $expiryD, $expiryT )->escaped();