mediawiki-extensions-Thanks/includes/ThanksLogFormatter.php
Reedy 3749db7eba Namespace extension
Change-Id: Ic9e0b8d6b3cc6b9be4d6b026cb0a3b4a12aef38f
2021-03-20 18:22:17 -07:00

32 lines
812 B
PHP

<?php
namespace MediaWiki\Extension\Thanks;
use LogFormatter;
use Message;
use Title;
use User;
/**
* This class formats log entries for thanks
*/
class ThanksLogFormatter extends LogFormatter {
/**
* @inheritDoc
*/
protected function getMessageParameters() {
$params = parent::getMessageParameters();
// Convert target from a pageLink to a userLink since the target is
// actually a user, not a page.
$recipient = User::newFromName( $this->entry->getTarget()->getText(), false );
$params[2] = Message::rawParam( $this->makeUserLink( $recipient ) );
$params[3] = $recipient->getName();
return $params;
}
public function getPreloadTitles() {
// Add the recipient's user talk page to LinkBatch
return [ Title::makeTitle( NS_USER_TALK, $this->entry->getTarget()->getText() ) ];
}
}