63 public function format( array $templates,
$type =
false, $more =
null ) {
69 # Do a batch existence check
70 $linkBatchFactory = MediaWikiServices::getInstance()->getLinkBatchFactory();
71 $batch = $linkBatchFactory->newLinkBatch( $templates );
75 $outText =
'<div class="mw-templatesUsedExplanation">';
76 $count = count( $templates );
77 if (
$type ===
'preview' ) {
78 $outText .= $this->context->msg(
'templatesusedpreview' )->numParams( $count )
80 } elseif (
$type ===
'section' ) {
81 $outText .= $this->context->msg(
'templatesusedsection' )->numParams( $count )
84 $outText .= $this->context->msg(
'templatesused' )->numParams( $count )
87 $outText .=
"</div><ul>\n";
89 usort( $templates,
'Title::compare' );
90 foreach ( $templates as $template ) {
96 $more, $this->context->msg(
'moredotdotdot' )->text() ) );
117 return '<li>' . $this->linkRenderer->makeLink( $target )
118 . $this->context->msg(
'word-separator' )->escaped()
119 . $this->context->msg(
'parentheses' )->rawParams( $editLink )->escaped()
120 . $this->context->msg(
'word-separator' )->escaped()
121 . $protected .
'</li>';
133 if ( !$restrictions ) {
139 if ( $restrictions === [
'sysop' ] ) {
140 $msg = $this->context->msg(
'template-protected' );
141 } elseif ( $restrictions === [
'autoconfirmed' ] ) {
142 $msg = $this->context->msg(
'template-semiprotected' );
144 if ( $msg && !$msg->isDisabled() ) {
145 $protected = $msg->parse();
150 foreach ( $restrictions as $r ) {
151 $msgs[] = $this->context->msg(
"restriction-level-$r" )->parse();
153 $protected = $this->context->msg(
'parentheses' )
154 ->rawParams( $this->context->getLanguage()->commaList( $msgs ) )->escaped();
169 ->quickUserCan(
'edit', $this->context->getUser(), $titleObj )
171 $linkMsg =
'editlink';
173 $linkMsg =
'viewsourcelink';
176 return $this->linkRenderer->makeLink(
178 $this->context->msg( $linkMsg )->text(),
180 [
'action' =>
'edit' ]