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

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

Methods

__construct()  : mixed
moveRecord()  : mixed
Hook for \TYPO3\CMS\Core\DataHandling\DataHandler::moveRecord that cares about moving records that are *not* in the live workspace
processCmdmap()  : mixed
hook that is called when no prepared command was found
processCmdmap_afterFinish()  : mixed
hook that is called AFTER all commands of the commandmap was executed
processCmdmap_beforeStart()  : mixed
hook that is called before any cmd of the commandmap is executed
processCmdmap_deleteAction()  : mixed
hook that is called when an element shall get deleted
processCmdmap_postProcess()  : mixed
In case a sys_workspace_stage record is deleted we do a hard reset for all existing records in that stage to avoid that any of these end up as orphan records.
processDatamap_afterAllOperations()  : void
updateInlineForeignFieldSorting()  : mixed
Updates foreign field sorting values of versioned and live parents after(!) the whole structure has been published.
createRelationHandlerInstance()  : RelationHandler
emitUpdateTopbarSignal()  : void
flushWorkspaceCacheEntriesByWorkspaceId()  : void
Flushes the workspace cache for current workspace and for the virtual "all workspaces" too.
flushWorkspaceElements()  : void
Flushes (remove, no soft delete!) elements of a particular workspace to avoid orphan records.
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.
getUniqueFields()  : array<string|int, string>
Returns all fieldnames from a table which have the unique evaluation type set.
moveRecord_moveVersionedRecord()  : void
Moves a versioned record, which is not new or deleted.
moveRecord_processFields()  : mixed
Processes fields of a moved record and follows references.
moveRecord_processFieldValue()  : void
Processes a single field of a moved record and follows references.
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.
resetStageOfElements()  : void
In case a sys_workspace_stage record is deleted we do a hard reset for all existing records in that stage to avoid that any of these end up as orphan records.
sendStageChangeNotification()  : void
softOrHardDeleteSingleRecord()  : void
Straight db based record deletion: sets deleted = 1 for soft-delete enabled tables, or removes row from table. Used for move placeholder records sometimes.
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()  : mixed
Setting stage of record
version_swap()  : mixed
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

$notificationEmailInfo

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

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

$remappedIds

Contains remapped IDs.

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

Methods

moveRecord()

Hook for \TYPO3\CMS\Core\DataHandling\DataHandler::moveRecord that cares about moving records that are *not* in the live workspace

public moveRecord(string $table, int $uid, int $destPid, array<string|int, mixed> $propArr, array<string|int, mixed> $moveRec, int $resolvedPid, bool &$recordWasMoved, DataHandler $dataHandler) : mixed
Parameters
$table : string

the table of the record

$uid : int

the ID of the record

$destPid : int

Position to move to: $destPid: >=0 then it points to

$propArr : array<string|int, mixed>

Record properties, like header and pid (includes workspace overlay)

$moveRec : array<string|int, mixed>

Record properties, like header and pid (without workspace overlay)

$resolvedPid : int

The final page ID of the record

$recordWasMoved : bool

can be set so that other hooks or

$dataHandler : DataHandler

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 that is called AFTER all commands of the commandmap was executed

public processCmdmap_afterFinish(DataHandler $dataHandler) : mixed
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

processCmdmap_deleteAction()

hook that is called when an element shall get deleted

public processCmdmap_deleteAction(string $table, int $id, array<string|int, mixed> $record, bool &$recordWasDeleted, DataHandler $dataHandler) : mixed
Parameters
$table : string

the table of the record

$id : int

the ID of the record

$record : array<string|int, mixed>

The accordant database record

$recordWasDeleted : bool

can be set so that other hooks or

$dataHandler : DataHandler

reference to the main DataHandler object

processCmdmap_postProcess()

In case a sys_workspace_stage record is deleted we do a hard reset for all existing records in that stage to avoid that any of these end up as orphan records.

public processCmdmap_postProcess(string $command, string $table, string $id, string $value, DataHandler $dataHandler) : mixed
Parameters
$command : string
$table : string
$id : string
$value : string
$dataHandler : DataHandler

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

emitUpdateTopbarSignal()

protected emitUpdateTopbarSignal() : void

flushWorkspaceCacheEntriesByWorkspaceId()

Flushes the workspace cache for current workspace and for the virtual "all workspaces" too.

protected flushWorkspaceCacheEntriesByWorkspaceId(int $workspaceId) : void
Parameters
$workspaceId : int

The workspace to be flushed in cache

flushWorkspaceElements()

Flushes (remove, no soft delete!) elements of a particular workspace to avoid orphan records.

protected flushWorkspaceElements(int $workspaceId) : void

This is used if an admin deletes a sys_workspace record.

Parameters
$workspaceId : int

The workspace to be flushed

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

getUniqueFields()

Returns all fieldnames from a table which have the unique evaluation type set.

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

Array of fieldnames

moveRecord_moveVersionedRecord()

Moves a versioned record, which is not new or deleted.

protected moveRecord_moveVersionedRecord(string $table, int $liveUid, int $destPid, int $versionedRecordUid, DataHandler $dataHandler) : void

This is critical for a versioned record to be marked as MOVED (t3ver_state=4)

Parameters
$table : string

Table name to move

$liveUid : int

Record uid to move (online record)

$destPid : int

Position to move to: $destPid: >=0 then it points to a page-id on which to insert the record (as the first element). <0 then it points to a uid from its own table after which to insert it (works if

$versionedRecordUid : int

UID of offline version of online record

$dataHandler : DataHandler

DataHandler object

Tags
see
moveRecord()

moveRecord_processFields()

Processes fields of a moved record and follows references.

protected moveRecord_processFields(DataHandler $dataHandler, int $resolvedPageId, string $table, int $uid) : mixed
Parameters
$dataHandler : DataHandler

Calling DataHandler instance

$resolvedPageId : int

Resolved real destination page id

$table : string

Name of parent table

$uid : int

UID of the parent record

moveRecord_processFieldValue()

Processes a single field of a moved record and follows references.

protected moveRecord_processFieldValue(DataHandler $dataHandler, int $resolvedPageId, string $table, int $uid, string $value, InlineFieldType|FileFieldType $fieldInformation) : void
Parameters
$dataHandler : DataHandler

Calling DataHandler instance

$resolvedPageId : int

Resolved real destination page id

$table : string

Name of parent table

$uid : int

UID of the parent record

$value : string

Value of the field of the parent record

$fieldInformation : InlineFieldType|FileFieldType

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>

resetStageOfElements()

In case a sys_workspace_stage record is deleted we do a hard reset for all existing records in that stage to avoid that any of these end up as orphan records.

protected resetStageOfElements(int $stageId) : void
Parameters
$stageId : int

Elements with this stage are reset

softOrHardDeleteSingleRecord()

Straight db based record deletion: sets deleted = 1 for soft-delete enabled tables, or removes row from table. Used for move placeholder records sometimes.

protected softOrHardDeleteSingleRecord(string $table, int $uid) : void
Parameters
$table : string
$uid : int

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

the workspace ID

$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 = [] ]) : mixed
Parameters
$table : string

Table name

$id : int
$stageId : int

Stage ID to set

$comment : string

Comment that goes into log

$dataHandler : DataHandler

DataHandler object

$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) : mixed
Parameters
$table : string

Table name

$id : int

UID of the online record to swap

$swapWith : int

UID of the archived 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