ElementHistoryController
Controller for showing the history module of TYPO3s backend.
This class is a specific Backend controller implementation and is not considered part of the Public TYPO3 API.
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<string|int, mixed>
- $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<string|int, mixed>|null
- Gets a database record (cached).
- groupLinesByOperation() : array<string|int, mixed>
- 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<string|int, mixed>
- renderDiff() : array<string|int, mixed>
- 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
$historyObject
protected
RecordHistory
$historyObject
$iconFactory read-only
protected
IconFactory
$iconFactory
$moduleTemplateFactory read-only
protected
ModuleTemplateFactory
$moduleTemplateFactory
$recordCache
protected
array<string|int, mixed>
$recordCache
= []
$returnUrl
protected
string
$returnUrl
= ''
$showDiff
Display inline differences or not
protected
bool
$showDiff
= true
$uriBuilder read-only
protected
UriBuilder
$uriBuilder
$view
protected
ModuleTemplate
$view
Methods
__construct()
public
__construct(IconFactory $iconFactory, UriBuilder $uriBuilder, ModuleTemplateFactory $moduleTemplateFactory, DiffUtility $diffUtility, FlexFormValueFormatter $flexFormValueFormatter, TcaSchemaFactory $tcaSchemaFactory, ComponentFactory $componentFactory, SiteFinder $siteFinder) : mixed
Parameters
- $iconFactory : IconFactory
- $uriBuilder : UriBuilder
- $moduleTemplateFactory : ModuleTemplateFactory
- $diffUtility : DiffUtility
- $flexFormValueFormatter : FlexFormValueFormatter
- $tcaSchemaFactory : TcaSchemaFactory
- $componentFactory : ComponentFactory
- $siteFinder : SiteFinder
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
ResponseInterfaceaddLanguageSwitcher()
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<string|int, mixed> $overrideParameters = [] ]) : string
Parameters
- $overrideParameters : array<string|int, mixed> = []
Return values
stringcountRecordsInOperation()
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
intdisplayHistory()
Shows the full change log
protected
displayHistory(array<string|int, mixed> $historyEntries) : void
Parameters
- $historyEntries : array<string|int, mixed>
displayMultipleDiff()
Displays a diff over multiple fields including rollback links
protected
displayMultipleDiff(array<string|int, mixed> $diff) : void
Parameters
- $diff : array<string|int, mixed>
-
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
stringgenerateTitle()
Generates the title and puts the record title behind
protected
generateTitle(string $table, string $uid) : string
Parameters
- $table : string
- $uid : string
Return values
stringgetBackendUser()
protected
getBackendUser() : BackendUserAuthentication
Return values
BackendUserAuthenticationgetButtons()
protected
getButtons() : void
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
boolgetLanguageService()
protected
getLanguageService() : LanguageService
Return values
LanguageServicegetRecord()
Gets a database record (cached).
protected
getRecord(string $table, int $uid) : array<string|int, mixed>|null
Parameters
- $table : string
- $uid : int
Return values
array<string|int, mixed>|nullgroupLinesByOperation()
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<string|int, mixed> $lines) : array<string|int, mixed>
Entries without a scope cannot be attributed to an operation and stay on their own.
Parameters
- $lines : array<string|int, mixed>
Return values
array<string|int, mixed>processSettings()
protected
processSettings(ServerRequestInterface $request) : array<string|int, mixed>
Parameters
- $request : ServerRequestInterface
Return values
array<string|int, mixed>renderDiff()
Renders HTML table-rows with the comparison information of a sys_history entry record
protected
renderDiff(array<string|int, mixed> $entry, string $table, int $rollbackUid[, bool $showRollbackLink = false ]) : array<string|int, mixed>
Parameters
- $entry : array<string|int, mixed>
-
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<string|int, mixed> —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