MediaWiki master
ContentModelLogFormatter.php
Go to the documentation of this file.
1<?php
2
3namespace MediaWiki\Logging;
4
7
9 protected function getMessageParameters() {
10 $lang = $this->context->getLanguage();
11 $params = parent::getMessageParameters();
12 $params[3] = ContentHandler::getLocalizedName( $params[3], $lang );
13 $params[4] = ContentHandler::getLocalizedName( $params[4], $lang );
14 return $params;
15 }
16
17 public function getActionLinks() {
18 if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) // Action is hidden
19 || $this->entry->getSubtype() !== 'change'
20 || !$this->context->getAuthority()->isAllowed( 'editcontentmodel' )
21 ) {
22 return '';
23 }
24
25 $params = $this->extractParameters();
26 $revert = $this->getLinkRenderer()->makeKnownLink(
27 SpecialPage::getTitleFor( 'ChangeContentModel' ),
28 $this->msg( 'logentry-contentmodel-change-revertlink' )->text(),
29 [],
30 [
31 'pagetitle' => $this->entry->getTarget()->getPrefixedText(),
32 'model' => $params[3],
33 'reason' => $this->msg( 'logentry-contentmodel-change-revert' )->inContentLanguage()->text(),
34 ]
35 );
36
37 return $this->msg( 'parentheses' )->rawParams( $revert )->escaped();
38 }
39}
40
42class_alias( ContentModelLogFormatter::class, 'ContentModelLogFormatter' );
Base class for content handling.
getMessageParameters()
Formats parameters intended for action message from array of all parameters.
getActionLinks()
Returns extra links that comes after the action text, like "revert", etc.
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,...
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Ge...