63 public function format( array $templates,
$type =
false, $more =
null ) {
69 # Do a batch existence check
70 (
new LinkBatch( $templates ) )->execute();
73 $outText =
'<div class="mw-templatesUsedExplanation">';
74 $count = count( $templates );
75 if (
$type ===
'preview' ) {
76 $outText .= $this->context->msg(
'templatesusedpreview' )->numParams( $count )
78 } elseif (
$type ===
'section' ) {
79 $outText .= $this->context->msg(
'templatesusedsection' )->numParams( $count )
82 $outText .= $this->context->msg(
'templatesused' )->numParams( $count )
85 $outText .=
"</div><ul>\n";
87 usort( $templates,
'Title::compare' );
88 foreach ( $templates as $template ) {
93 $outText .= Html::rawElement(
'li', [], $this->linkRenderer->makeLink(
94 $more, $this->context->msg(
'moredotdotdot' )->text() ) );
97 $outText .= Html::rawElement(
'li', [], $more );
115 return '<li>' . $this->linkRenderer->makeLink( $target )
116 . $this->context->msg(
'word-separator' )->escaped()
117 . $this->context->msg(
'parentheses' )->rawParams( $editLink )->escaped()
118 . $this->context->msg(
'word-separator' )->escaped()
119 . $protected .
'</li>';
131 if ( !$restrictions ) {
137 if ( $restrictions === [
'sysop' ] ) {
138 $msg = $this->context->msg(
'template-protected' );
139 } elseif ( $restrictions === [
'autoconfirmed' ] ) {
140 $msg = $this->context->msg(
'template-semiprotected' );
142 if ( $msg && !$msg->isDisabled() ) {
143 $protected = $msg->parse();
148 foreach ( $restrictions as $r ) {
149 $msgs[] = $this->context->msg(
"restriction-level-$r" )->parse();
151 $protected = $this->context->msg(
'parentheses' )
152 ->rawParams( $this->context->getLanguage()->commaList( $msgs ) )->escaped();
167 ->quickUserCan(
'edit', $this->context->getUser(), $titleObj )
169 $linkMsg =
'editlink';
171 $linkMsg =
'viewsourcelink';
174 return $this->linkRenderer->makeLink(
176 $this->context->msg( $linkMsg )->text(),
178 [
'action' =>
'edit' ]