use MediaWiki\Linker\LinkRenderer;
use MediaWiki\Linker\LinkTarget;
+use MediaWiki\MediaWikiServices;
/**
* Handles formatting for the "templates used on this page"
}
# Do a batch existence check
- $batch = new LinkBatch;
- foreach ( $templates as $title ) {
- $batch->addObj( $title );
- }
- $batch->execute();
+ ( new LinkBatch( $templates ) )->execute();
# Construct the HTML
$outText = '<div class="mw-templatesUsedExplanation">';
}
if ( $more instanceof LinkTarget ) {
- $outText .= Html::rawElement( 'li', $this->linkRenderer->makeLink(
+ $outText .= Html::rawElement( 'li', [], $this->linkRenderer->makeLink(
$more, $this->context->msg( 'moredotdotdot' )->text() ) );
} elseif ( $more ) {
// Documented as should already be escaped
- $outText .= Html::rawElement( 'li', $more );
+ $outText .= Html::rawElement( 'li', [], $more );
}
$outText .= '</ul>';
* Return a link to the edit page, with the text
* saying "view source" if the user can't edit the page
*
- * @param Title $titleObj
+ * @param LinkTarget $titleObj
* @return string
*/
- private function buildEditLink( Title $titleObj ) {
- if ( $titleObj->quickUserCan( 'edit', $this->context->getUser() ) ) {
+ private function buildEditLink( LinkTarget $titleObj ) {
+ if ( MediaWikiServices::getInstance()->getPermissionManager()
+ ->quickUserCan( 'edit', $this->context->getUser(), $titleObj )
+ ) {
$linkMsg = 'editlink';
} else {
$linkMsg = 'viewsourcelink';