ElementHistoryController

class \TYPO3\CMS\Backend\Controller\ContentElement\ElementHistoryController

Controller for showing the history module of TYPO3s backend.

Attributes

#[AsController]

Table of Contents

Properties

$groupByOperation  : bool
Show entries of one operation as a group instead of a flat list
$historyObject  : RecordHistory
$iconFactory  : IconFactory
$moduleTemplateFactory  : ModuleTemplateFactory
$recordCache  : array
$returnUrl  : string
$showDiff  : bool
Display inline differences or not
$uriBuilder  : UriBuilder
$view  : ModuleTemplate

Methods

__construct()  : mixed
mainAction()  : ResponseInterface
Injects the request object for the current request or sub request As this controller goes only through the main() method, it is rather simple for now
addLanguageSwitcher()  : void
Add a translation selection dropdown if the record is language aware.
buildUrl()  : string
Generates the URL for a link to the current page
countRecordsInOperation()  : int
How many records the whole operation touched, which is more than the changelog of a single record shows. Only records the user may see are counted.
displayHistory()  : void
Shows the full change log
displayMultipleDiff()  : void
Displays a diff over multiple fields including rollback links
generatePageTitle()  : string
Renders a page reference of a move as title plus uid, so a page that has been deleted in the meantime is still identifiable.
generateTitle()  : string
Generates the title and puts the record title behind
getBackendUser()  : BackendUserAuthentication
getButtons()  : void
getEditLockFromElement()  : bool
Get the editlock value from page of a history element
getLanguageService()  : LanguageService
getRecord()  : array|null
Gets a database record (cached).
groupLinesByOperation()  : array
Puts the entries of one operation next to each other and marks the first of them, so the view can introduce the group with a header. Entries written during the same DataHandler run share the scope of their correlation id, but they are spread over the changelog because it is sorted by time, and one operation writes all its entries in the same second.
processSettings()  : array
renderDiff()  : array
Renders HTML table-rows with the comparison information of a sys_history entry record
rollbackOperation()  : void
Rolls back every change of one operation at once. The entries of an operation share the scope of their correlation id, and they already carry everything a rollback needs, so the regular rollback runs over the whole set instead of a single record.
setPagePath()  : void
Creates the correct path to the current record

Properties

$groupByOperation

Show entries of one operation as a group instead of a flat list

protected bool $groupByOperation = false

$recordCache

protected array $recordCache = []

$returnUrl

protected string $returnUrl = ''

$showDiff

Display inline differences or not

protected bool $showDiff = true

Methods

__construct()

public __construct(IconFactory $iconFactory, UriBuilder $uriBuilder, ModuleTemplateFactory $moduleTemplateFactory, DiffUtility $diffUtility, FlexFormValueFormatter $flexFormValueFormatter, TcaSchemaFactory $tcaSchemaFactory, ComponentFactory $componentFactory, SiteFinder $siteFinder, LanguageSelectorBuilder $languageSelectorBuilder) : mixed

Parameters

$iconFactory : IconFactory
$uriBuilder : UriBuilder
$moduleTemplateFactory : ModuleTemplateFactory
$diffUtility : DiffUtility
$flexFormValueFormatter : FlexFormValueFormatter
$tcaSchemaFactory : TcaSchemaFactory
$componentFactory : ComponentFactory
$siteFinder : SiteFinder
$languageSelectorBuilder : LanguageSelectorBuilder

mainAction()

Injects the request object for the current request or sub request As this controller goes only through the main() method, it is rather simple for now

public mainAction(ServerRequestInterface $request) : ResponseInterface

Parameters

$request : ServerRequestInterface

Return values

ResponseInterface

addLanguageSwitcher()

Add a translation selection dropdown if the record is language aware.

protected addLanguageSwitcher(ServerRequestInterface $request, BackendUserAuthentication $backendUser, string $element) : void

Parameters

$request : ServerRequestInterface
$backendUser : BackendUserAuthentication
$element : string

buildUrl()

Generates the URL for a link to the current page

protected buildUrl([array $overrideParameters = [] ]) : string

Parameters

$overrideParameters : array = []

Return values

string

countRecordsInOperation()

How many records the whole operation touched, which is more than the changelog of a single record shows. Only records the user may see are counted.

protected countRecordsInOperation(string $scope) : int

Parameters

$scope : string

Return values

int

displayHistory()

Shows the full change log

protected displayHistory(array $historyEntries) : void

Parameters

$historyEntries : array

displayMultipleDiff()

Displays a diff over multiple fields including rollback links

protected displayMultipleDiff(array $diff) : void

Parameters

$diff : array

Difference array

generatePageTitle()

Renders a page reference of a move as title plus uid, so a page that has been deleted in the meantime is still identifiable.

protected generatePageTitle(int $pageId) : string

Parameters

$pageId : int

Return values

string

generateTitle()

Generates the title and puts the record title behind

protected generateTitle(string $table, string $uid) : string

Parameters

$table : string
$uid : string

Return values

string

getEditLockFromElement()

Get the editlock value from page of a history element

protected getEditLockFromElement(string $tableName, int $elementUid) : bool

Parameters

$tableName : string
$elementUid : int

Return values

bool

getRecord()

Gets a database record (cached).

protected getRecord(string $table, int $uid) : array|null

Parameters

$table : string
$uid : int

Return values

array|null

groupLinesByOperation()

Puts the entries of one operation next to each other and marks the first of them, so the view can introduce the group with a header. Entries written during the same DataHandler run share the scope of their correlation id, but they are spread over the changelog because it is sorted by time, and one operation writes all its entries in the same second.

protected groupLinesByOperation(array $lines) : array

Entries without a scope cannot be attributed to an operation and stay on their own.

Parameters

$lines : array

Return values

array

processSettings()

protected processSettings(ServerRequestInterface $request) : array

Parameters

$request : ServerRequestInterface

Return values

array

renderDiff()

Renders HTML table-rows with the comparison information of a sys_history entry record

protected renderDiff(array $entry, string $table, int $rollbackUid[, bool $showRollbackLink = false ]) : array

Parameters

$entry : array

sys_history entry record.

$table : string

The table name

$rollbackUid : int

The UID of the record

$showRollbackLink : bool = false

Whether a rollback link should be shown for each changed field

Return values

array —

array of records

rollbackOperation()

Rolls back every change of one operation at once. The entries of an operation share the scope of their correlation id, and they already carry everything a rollback needs, so the regular rollback runs over the whole set instead of a single record.

protected rollbackOperation(string $scope) : void

Parameters

$scope : string

setPagePath()

Creates the correct path to the current record

protected setPagePath(string $table, int $uid) : void

Parameters

$table : string
$uid : int
On this page