DataHandlerHook

Contains some parts for staging, versioning and workspaces to interact with the TYPO3 Core Engine.

Internal

This is a specific hook implementation and is not considered part of the Public TYPO3 API.

Attributes
#[Autoconfigure]
$public: true

Table of Contents

Properties

$notificationInfo  : array<string|int, mixed>
For accumulating information about workspace stages raised on elements so a single email is sent as notification.
$remappedIds  : array<string|int, mixed>
Contains remapped IDs.

Methods

__construct()  : mixed
processCmdmap()  : mixed
hook that is called when no prepared command was found
processCmdmap_afterFinish()  : void
Hook called after all commands of the command map were done
processCmdmap_beforeStart()  : mixed
hook that is called before any cmd of the commandmap is executed
updateInlineForeignFieldSorting()  : mixed
Updates foreign field sorting values of versioned and live parents after(!) the whole structure has been published.
createNotificationInformation()  : array<string|int, mixed>
createRelationHandlerInstance()  : RelationHandler
getFieldNamesToKeep()  : array<string|int, string>
Returns all fieldnames from a table which have the unique evaluation type set, that should not exchange the content between LIVE and the versioned record.
getRecordHistoryStore()  : RecordHistoryStore
Makes an instance for RecordHistoryStore. This is needed as DataHandler would usually trigger the setHistory() but has no support for tracking "stage change" information.
publishNewRecord()  : void
When a new record in a workspace is published, there is no "replacing" the online version with the versioned record, but instead the workspace ID and the state is changed.
updateL10nOverlayRecordsOnPublish()  : void
If an editor is doing "partial" publishing, the translated children need to be "linked" to the now pointed live record, as if the versioned record (which is deleted) would have never existed.
updateReferenceIndexForL10nOverlays()  : void
A new record was just published, but the reference index for the localized elements needs an update too.
version_setStage()  : void
Setting stage of record
version_swap()  : void
Publishing / Swapping (= switching) versions of a record Version from archive (future/past, called "swap version") will get the uid of the "t3ver_oid", the official element with uid = "t3ver_oid" will get the new versions old uid. PIDs are swapped also
version_swap_processFields()  : mixed
Processes fields of a record for the publishing/swapping process.

Properties

$notificationInfo

For accumulating information about workspace stages raised on elements so a single email is sent as notification.

protected array<string|int, mixed> $notificationInfo = []

$remappedIds

Contains remapped IDs.

protected array<string|int, mixed> $remappedIds = []

Methods

processCmdmap()

hook that is called when no prepared command was found

public processCmdmap(string $command, string $table, int $id, array<string|int, mixed> $value, bool &$commandIsProcessed, DataHandler $dataHandler) : mixed
Parameters
$command : string

the command to be executed

$table : string

the table of the record

$id : int

the ID of the record

$value : array<string|int, mixed>

the value containing the data

$commandIsProcessed : bool

can be set so that other hooks or

$dataHandler : DataHandler

reference to the main DataHandler object

processCmdmap_afterFinish()

Hook called after all commands of the command map were done

public processCmdmap_afterFinish(DataHandler $dataHandler) : void
Parameters
$dataHandler : DataHandler

reference to the main DataHandler object

processCmdmap_beforeStart()

hook that is called before any cmd of the commandmap is executed

public processCmdmap_beforeStart(DataHandler $dataHandler) : mixed
Parameters
$dataHandler : DataHandler

reference to the main DataHandler object

updateInlineForeignFieldSorting()

Updates foreign field sorting values of versioned and live parents after(!) the whole structure has been published.

public updateInlineForeignFieldSorting(int $parentId, string $foreignTableName, array<string|int, int> $foreignIds, array<string|int, mixed> $configuration, int $targetWorkspaceId) : mixed

This method is used as callback function in DataHandlerHook::version_swap_procBasedOnFieldType(). Sorting fields ("sortby") are not modified during the workspace publishing/swapping process directly.

Parameters
$parentId : int
$foreignTableName : string
$foreignIds : array<string|int, int>
$configuration : array<string|int, mixed>
$targetWorkspaceId : int
Internal

createNotificationInformation()

protected createNotificationInformation(array<string|int, mixed> $notificationBatch, array<string|int, mixed> $workspaceInfo, string $table, int $id, int $stageId, string $comment, array<string|int, mixed> $recipients) : array<string|int, mixed>
Parameters
$notificationBatch : array<string|int, mixed>
$workspaceInfo : array<string|int, mixed>
$table : string
$id : int
$stageId : int
$comment : string
$recipients : array<string|int, mixed>
Return values
array<string|int, mixed>

getFieldNamesToKeep()

Returns all fieldnames from a table which have the unique evaluation type set, that should not exchange the content between LIVE and the versioned record.

protected getFieldNamesToKeep(TcaSchema $schema) : array<string|int, string>
Parameters
$schema : TcaSchema
Return values
array<string|int, string>

Array of fieldnames

getRecordHistoryStore()

Makes an instance for RecordHistoryStore. This is needed as DataHandler would usually trigger the setHistory() but has no support for tracking "stage change" information.

protected getRecordHistoryStore(int $workspaceId, BackendUserAuthentication $user) : RecordHistoryStore

So we have to do this manually. Usually a $dataHandler->updateDB() could do this, but we use raw update statements here in workspaces for the time being, mostly because we also want to add "comment"

Parameters
$workspaceId : int
$user : BackendUserAuthentication
Return values
RecordHistoryStore

publishNewRecord()

When a new record in a workspace is published, there is no "replacing" the online version with the versioned record, but instead the workspace ID and the state is changed.

protected publishNewRecord(string $table, array<string|int, mixed> $newRecordInWorkspace, DataHandler $dataHandler, string $comment, array<string|int, mixed> $notificationAlternativeRecipients) : void
Parameters
$table : string
$newRecordInWorkspace : array<string|int, mixed>
$dataHandler : DataHandler
$comment : string
$notificationAlternativeRecipients : array<string|int, mixed>

updateL10nOverlayRecordsOnPublish()

If an editor is doing "partial" publishing, the translated children need to be "linked" to the now pointed live record, as if the versioned record (which is deleted) would have never existed.

protected updateL10nOverlayRecordsOnPublish(TcaSchema $schema, int $liveId, int $previouslyUsedVersionId, int $workspaceId, DataHandler $dataHandler) : void

This is related to the l10n_source and l10n_parent fields.

This needs to happen before the hook calls DataHandler->deleteEl() otherwise the children get deleted as well.

Parameters
$schema : TcaSchema
$liveId : int

the live version / online version of the record that was just published

$previouslyUsedVersionId : int

the versioned record ID (wsid>0) which is about to be deleted

$workspaceId : int
$dataHandler : DataHandler

updateReferenceIndexForL10nOverlays()

A new record was just published, but the reference index for the localized elements needs an update too.

protected updateReferenceIndexForL10nOverlays(string $table, int $newVersionedRecordId, int $workspaceId, DataHandler $dataHandler) : void
Parameters
$table : string
$newVersionedRecordId : int
$workspaceId : int
$dataHandler : DataHandler

version_setStage()

Setting stage of record

protected version_setStage(string $table, int $id, int $stageId, string $comment, DataHandler $dataHandler[, array<string|int, mixed> $notificationAlternativeRecipients = [] ]) : void
Parameters
$table : string

Table name

$id : int
$stageId : int

Stage ID to set

$comment : string

Comment that goes into log

$dataHandler : DataHandler
$notificationAlternativeRecipients : array<string|int, mixed> = []

comma separated list of recipients to notify instead of normal be_users

version_swap()

Publishing / Swapping (= switching) versions of a record Version from archive (future/past, called "swap version") will get the uid of the "t3ver_oid", the official element with uid = "t3ver_oid" will get the new versions old uid. PIDs are swapped also

protected version_swap(string $table, int $id, int $swapWith, DataHandler $dataHandler, string $comment, array<string|int, mixed> $notificationAlternativeRecipients) : void
Parameters
$table : string

Table name

$id : int

UID of the online record to swap

$swapWith : int

UID of the workspace version to swap with!

$dataHandler : DataHandler

DataHandler object

$comment : string

Notification comment

$notificationAlternativeRecipients : array<string|int, mixed>

comma separated list of recipients to notify instead of normal be_users

version_swap_processFields()

Processes fields of a record for the publishing/swapping process.

protected version_swap_processFields(string $tableName, array<string|int, mixed> $configuration, array<string|int, mixed> $liveData, array<string|int, mixed> $versionData, DataHandler $dataHandler) : mixed

Basically this takes care of IRRE (type "inline") child references.

Parameters
$tableName : string

Table name

$configuration : array<string|int, mixed>

TCA field configuration

$liveData : array<string|int, mixed>

Live record data

$versionData : array<string|int, mixed>

Version record data

$dataHandler : DataHandler

Calling data-handler object


        
On this page

Search results