DataHandlerHook

class \TYPO3\CMS\Workspaces\Hook\DataHandlerHook

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

Attributes

#[Autoconfigure]
$public: true

Table of Contents

Properties

$notificationInfo  : array
For accumulating information about workspace stages raised on elements so a single email is sent as notification.
$remappedIds  : array
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
createRelationHandlerInstance()  : RelationHandler
getFieldNamesToKeep()  : 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 $notificationInfo = []

$remappedIds

Contains remapped IDs.

protected array $remappedIds = []

Methods

processCmdmap()

hook that is called when no prepared command was found

public processCmdmap(string $command, string $table, int $id, array $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

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, int[] $foreignIds, array $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 : int[]
$configuration : array
$targetWorkspaceId : int

createNotificationInformation()

protected createNotificationInformation(array $notificationBatch, array $workspaceInfo, string $table, int $id, int $stageId, string $comment, array $recipients) : array

Parameters

$notificationBatch : array
$workspaceInfo : array
$table : string
$id : int
$stageId : int
$comment : string
$recipients : array

Return values

array

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) : string[]

Parameters

$schema : TcaSchema

Return values

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 $newRecordInWorkspace, DataHandler $dataHandler, string $comment, array $notificationAlternativeRecipients) : void

Parameters

$table : string
$newRecordInWorkspace : array
$dataHandler : DataHandler
$comment : string
$notificationAlternativeRecipients : array

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 $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 = []

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 $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

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 $configuration, array $liveData, array $versionData, DataHandler $dataHandler) : mixed

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

Parameters

$tableName : string

Table name

$configuration : array

TCA field configuration

$liveData : array

Live record data

$versionData : array

Version record data

$dataHandler : DataHandler

Calling data-handler object

On this page