getAuthority(); # Rollback and undo links if ( ( $showRollbackLink || $previousRevRecord ) // probablyCan loads page restriction data, call only when needed && $authority->probablyCan( 'edit', $title ) ) { if ( $showRollbackLink && $authority->probablyCan( 'rollback', $title ) ) { // Get a rollback link without the brackets $rollbackLink = Linker::generateRollback( $revRecord, $context, [ 'noBrackets' ] ); if ( $rollbackLink ) { $this->preventClickjacking = true; $tools['mw-rollback'] = $rollbackLink; } } if ( $previousRevRecord && !$revRecord->isDeleted( RevisionRecord::DELETED_TEXT ) && !$previousRevRecord->isDeleted( RevisionRecord::DELETED_TEXT ) ) { # Create undo tooltip for the first (=latest) line only $undoTooltip = $showRollbackLink ? [ 'title' => $context->msg( 'tooltip-undo' )->text() ] : []; $undolink = $linkRenderer->makeKnownLink( $title, $context->msg( 'editundo' )->text(), $undoTooltip, [ 'action' => 'edit', 'undoafter' => $previousRevRecord->getId(), 'undo' => $revRecord->getId() ] ); $tools['mw-undo'] = "{$undolink}"; } } // Allow extension to add their own links here // FIXME previously this was only called on history; restore that and deprecate in favor // of a more generic hook (See T326180) $hookRunner->onHistoryTools( $revRecord, $tools, $previousRevRecord, $authority->getUser() ); $this->tools = $tools; } public function shouldPreventClickjacking() { return $this->preventClickjacking; } public function toHTML() { $tools = $this->tools; $s2 = ''; if ( $tools ) { $s2 .= ' ' . Html::openElement( 'span', [ 'class' => 'mw-changeslist-links mw-pager-tools' ] ); foreach ( $tools as $tool ) { $s2 .= Html::rawElement( 'span', [], $tool ); } $s2 .= Html::closeElement( 'span' ); } return $s2; } } /** * Retain the old class name for backwards compatibility. * @deprecated since 1.41 */ class_alias( PagerTools::class, 'PagerTools' );