MediaWiki master
ContentModelLogFormatter.php
Go to the documentation of this file.
1<?php
2
3namespace MediaWiki\Logging;
4
7
10 protected function getMessageParameters() {
11 $lang = $this->context->getLanguage();
12 $params = parent::getMessageParameters();
13 $params[3] = ContentHandler::getLocalizedName( $params[3], $lang );
14 $params[4] = ContentHandler::getLocalizedName( $params[4], $lang );
15 return $params;
16 }
17
19 public function getActionLinks() {
20 if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) // Action is hidden
21 || $this->entry->getSubtype() !== 'change'
22 || !$this->context->getAuthority()->isAllowed( 'editcontentmodel' )
23 ) {
24 return '';
25 }
26
27 $params = $this->extractParameters();
28 $revert = $this->getLinkRenderer()->makeKnownLink(
29 SpecialPage::getTitleFor( 'ChangeContentModel' ),
30 $this->msg( 'logentry-contentmodel-change-revertlink' )->text(),
31 [],
32 [
33 'pagetitle' => $this->entry->getTarget()->getPrefixedText(),
34 'model' => $params[3],
35 'reason' => $this->msg( 'logentry-contentmodel-change-revert' )->inContentLanguage()->text(),
36 ]
37 );
38
39 return $this->msg( 'parentheses' )->rawParams( $revert )->escaped();
40 }
41}
42
44class_alias( ContentModelLogFormatter::class, 'ContentModelLogFormatter' );
Base class for content handling.
getMessageParameters()
Formats parameters intended for action message from array of all parameters.There are three hardcoded...
getActionLinks()
Returns extra links that comes after the action text, like "revert", etc.to override string
Implements the default log formatting.
extractParameters()
Extracts the optional extra parameters for use in action messages.
msg( $key,... $params)
Shortcut for wfMessage which honors local context.
Parent class for all special pages.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...