TYPO3  7.6
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DataHandlerHook Class Reference

Public Member Functions

 processCmdmap_beforeStart (DataHandler $tcemainObj)
 
 processCmdmap ($command, $table, $id, $value, &$commandIsProcessed, DataHandler $tcemainObj)
 
 processCmdmap_afterFinish (DataHandler $tcemainObj)
 
 processCmdmap_deleteAction ($table, $id, array $record, &$recordWasDeleted, DataHandler $tcemainObj)
 
 moveRecord ($table, $uid, $destPid, array $propArr, array $moveRec, $resolvedPid, &$recordWasMoved, DataHandler $tcemainObj)
 
 writeRemappedForeignField (\TYPO3\CMS\Core\Database\RelationHandler $dbAnalysis, array $configuration, $parentId)
 
 updateInlineForeignFieldSorting ($parentTableName, $parentId, $foreignTableName, $foreignIds, array $configuration, $targetWorkspaceId)
 
 findPageElementsForVersionSwap ($table, $id, $offlineId)
 
 findPageElementsForVersionStageChange (array $pageIdList, $workspaceId, array &$elementList)
 
 findPageIdsForVersionStateChange ($table, array $idList, $workspaceId, array &$pageIdList, array &$elementList)
 
 findRealPageIds (array &$idList)
 
 getCommandMap (DataHandler $tceMain)
 

Protected Member Functions

 moveRecord_processFields (DataHandler $dataHandler, $resolvedPageId, $table, $uid)
 
 moveRecord_processFieldValue (DataHandler $dataHandler, $resolvedPageId, $table, $uid, $field, $value, array $configuration)
 
 getEmailsForStageChangeNotification ($listOfUsers, $noTablePrefix=false)
 
 version_setStage ($table, $id, $stageId, $comment= '', $notificationEmailInfo=false, DataHandler $tcemainObj, array $notificationAlternativeRecipients=array())
 
 versionizePages ($uid, $label, $versionizeTree, DataHandler $tcemainObj)
 
 version_swap_processFields ($tableName, $fieldName, array $configuration, array $liveData, array $versionData, DataHandler $dataHandler)
 
 version_clearWSID ($table, $id, $flush=false, DataHandler $tcemainObj)
 
 rawCopyPageContent ($oldPageId, $newPageId, array $copyTablesArray, DataHandler $tcemainObj)
 
 moveRecord_wsPlaceholders ($table, $uid, $destPid, $wsUid, DataHandler $tcemainObj)
 
 getPossibleInlineChildTablesOfParentTable ($parentTable, array $possibleInlineChildren=array())
 
 getUniqueFields ($table)
 
 createRelationHandlerInstance ()
 

Protected Attributes

 $notificationEmailInfo = array()
 
 $remappedIds = array()
 

Detailed Description

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

Definition at line 29 of file version/Classes/Hook/DataHandlerHook.php.

Member Function Documentation

createRelationHandlerInstance ( )
protected
findPageElementsForVersionStageChange ( array  $pageIdList,
  $workspaceId,
array &  $elementList 
)

Searches for all elements from all tables on the given pages in the same workspace.

Parameters
array$pageIdListList of PIDs to search
int$workspaceIdWorkspace ID
array$elementListList of found elements. Key is table name, value is array of element UIDs
Returns
void

Definition at line 1262 of file version/Classes/Hook/DataHandlerHook.php.

References $GLOBALS, and BackendUtility\deleteClause().

findPageElementsForVersionSwap (   $table,
  $id,
  $offlineId 
)

Finds all elements for swapping versions in workspace

Parameters
string$tableTable name of the original element to swap
int$idUID of the original element to swap (online)
int$offlineIdAs above but offline
Returns
array Element data. Key is table name, values are array with first element as online UID, second - offline UID

Definition at line 1219 of file version/Classes/Hook/DataHandlerHook.php.

References $GLOBALS, BackendUtility\deleteClause(), BackendUtility\getRecord(), and BackendUtility\workspaceOL().

findPageIdsForVersionStateChange (   $table,
array  $idList,
  $workspaceId,
array &  $pageIdList,
array &  $elementList 
)

Finds page UIDs for the element from table $table with UIDs from $idList

Parameters
string$tableTable to search
array$idListList of records' UIDs
int$workspaceIdWorkspace ID. We need this parameter because user can be in LIVE but he still can publisg DRAFT from ws module!
array$pageIdListList of found page UIDs
array$elementListList of found element UIDs. Key is table name, value is list of UIDs
Returns
void

Definition at line 1294 of file version/Classes/Hook/DataHandlerHook.php.

References $GLOBALS, BackendUtility\deleteClause(), BackendUtility\getRecord(), and BackendUtility\workspaceOL().

findRealPageIds ( array &  $idList)

Finds real page IDs for state change.

Parameters
array$idListList of page UIDs, possibly versioned
Returns
void

Definition at line 1323 of file version/Classes/Hook/DataHandlerHook.php.

References BackendUtility\getRecord().

getCommandMap ( DataHandler  $tceMain)

Gets an instance of the command map helper.

Parameters
DataHandler$tceMainTCEmain object
Returns

Definition at line 1467 of file version/Classes/Hook/DataHandlerHook.php.

References GeneralUtility\makeInstance().

Referenced by DataHandlerHook\processCmdmap_beforeStart().

getEmailsForStageChangeNotification (   $listOfUsers,
  $noTablePrefix = false 
)
protected

Return be_users that should be notified on stage change from input list. previously called notifyStageChange_getEmails() in tcemain

Parameters
string$listOfUsersList of backend users, on the form "be_users_10,be_users_2" or "10,2" in case noTablePrefix is set.
bool$noTablePrefixIf set, the input list are integers and not strings.
Returns
array Array of emails

Definition at line 637 of file version/Classes/Hook/DataHandlerHook.php.

References BackendUtility\BEenableFields(), BackendUtility\getRecord(), GeneralUtility\revExplode(), and GeneralUtility\trimExplode().

getPossibleInlineChildTablesOfParentTable (   $parentTable,
array  $possibleInlineChildren = array() 
)
protected

Gets all possible child tables that are used on each parent table as field.

Parameters
string$parentTableName of the parent table
array$possibleInlineChildrenCollected possible inline children
Returns
array

Definition at line 1446 of file version/Classes/Hook/DataHandlerHook.php.

References $GLOBALS.

Referenced by DataHandlerHook\versionizePages().

getUniqueFields (   $table)
protected

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

Parameters
string$tableTable name
Returns
array Array of fieldnames

Definition at line 1484 of file version/Classes/Hook/DataHandlerHook.php.

References $GLOBALS, and GeneralUtility\trimExplode().

moveRecord (   $table,
  $uid,
  $destPid,
array  $propArr,
array  $moveRec,
  $resolvedPid,
$recordWasMoved,
DataHandler  $tcemainObj 
)

Hook for ::moveRecord that cares about moving records that are not in the live workspace

Parameters
string$tablethe table of the record
int$uidthe ID of the record
int$destPidPosition to move to: $destPid: >=0 then it points to
array$propArrRecord properties, like header and pid (includes workspace overlay)
array$moveRecRecord properties, like header and pid (without workspace overlay)
int$resolvedPidThe final page ID of the record
bool$recordWasMovedcan be set so that other hooks or
DataHandler$tcemainObj
Returns
void

Definition at line 270 of file version/Classes/Hook/DataHandlerHook.php.

References Enumeration\cast(), elseif, BackendUtility\getMovePlaceholder(), BackendUtility\getWorkspaceVersionOfRecord(), DataHandler\isRecordCopied(), BackendUtility\isTableWorkspaceEnabled(), VersionState\MOVE_PLACEHOLDER, DataHandlerHook\moveRecord_processFields(), DataHandlerHook\moveRecord_wsPlaceholders(), DataHandler\newlog(), and DataHandler\versionizeRecord().

moveRecord_processFields ( DataHandler  $dataHandler,
  $resolvedPageId,
  $table,
  $uid 
)
protected

Processes fields of a moved record and follows references.

Parameters
DataHandler$dataHandlerCalling DataHandler instance
int$resolvedPageIdResolved real destination page id
string$tableName of parent table
int$uidUID of the parent record
Returns
void

Definition at line 352 of file version/Classes/Hook/DataHandlerHook.php.

References $GLOBALS, BackendUtility\getWorkspaceVersionOfRecord(), and DataHandlerHook\moveRecord_processFieldValue().

Referenced by DataHandlerHook\moveRecord().

moveRecord_processFieldValue ( DataHandler  $dataHandler,
  $resolvedPageId,
  $table,
  $uid,
  $field,
  $value,
array  $configuration 
)
protected

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

Parameters
DataHandler$dataHandlerCalling DataHandler instance
int$resolvedPageIdResolved real destination page id
string$tableName of parent table
int$uidUID of the parent record
string$fieldName of the field of the parent record
string$valueValue of the field of the parent record
array$configurationTCA field configuration of the parent record
Returns
void

Definition at line 382 of file version/Classes/Hook/DataHandlerHook.php.

References Enumeration\cast(), DataHandlerHook\createRelationHandlerInstance(), DataHandler\getInlineFieldType(), BackendUtility\getWorkspaceVersionOfRecord(), BackendUtility\isTableWorkspaceEnabled(), and DataHandler\moveRecord().

Referenced by DataHandlerHook\moveRecord_processFields().

moveRecord_wsPlaceholders (   $table,
  $uid,
  $destPid,
  $wsUid,
DataHandler  $tcemainObj 
)
protected

Creates a move placeholder for workspaces. USE ONLY INTERNALLY Moving placeholder: Can be done because the system sees it as a placeholder for NEW elements like t3ver_state=VersionState::NEW_PLACEHOLDER Moving original: Will either create the placeholder if it doesn't exist or move existing placeholder in workspace.

Parameters
string$tableTable name to move
int$uidRecord uid to move (online record)
int$destPidPosition 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
int$wsUidUID of offline version of online record
DataHandler$tcemainObjTCEmain object
Returns
void
See Also
moveRecord()

Definition at line 1347 of file version/Classes/Hook/DataHandlerHook.php.

References $GLOBALS, elseif, BackendUtility\getMovePlaceholder(), DataHandler\getPlaceholderTitleForTableLabel(), BackendUtility\getRecord(), DataHandler\insertDB(), VersionState\MOVE_PLACEHOLDER, VersionState\MOVE_POINTER, DataHandler\moveL10nOverlayRecords(), DataHandler\moveRecord_raw(), BackendUtility\readPageAccess(), and GeneralUtility\trimExplode().

Referenced by DataHandlerHook\moveRecord().

processCmdmap (   $command,
  $table,
  $id,
  $value,
$commandIsProcessed,
DataHandler  $tcemainObj 
)

hook that is called when no prepared command was found

Parameters
string$commandthe command to be executed
string$tablethe table of the record
int$idthe ID of the record
mixed$valuethe value containing the data
bool$commandIsProcessedcan be set so that other hooks or
DataHandler$tcemainObjreference to the main tcemain object
Returns
void

Definition at line 75 of file version/Classes/Hook/DataHandlerHook.php.

References GeneralUtility\trimExplode(), DataHandlerHook\version_clearWSID(), DataHandlerHook\version_setStage(), DataHandlerHook\versionizePages(), and DataHandler\versionizeRecord().

processCmdmap_afterFinish ( DataHandler  $tcemainObj)

hook that is called AFTER all commands of the commandmap was executed

Parameters
DataHandler$tcemainObjreference to the main tcemain object
Returns
void

Definition at line 135 of file version/Classes/Hook/DataHandlerHook.php.

processCmdmap_beforeStart ( DataHandler  $tcemainObj)

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

Parameters
DataHandler$tcemainObjreference to the main tcemain object
Returns
void

Definition at line 56 of file version/Classes/Hook/DataHandlerHook.php.

References DataHandlerHook\getCommandMap().

processCmdmap_deleteAction (   $table,
  $id,
array  $record,
$recordWasDeleted,
DataHandler  $tcemainObj 
)

hook that is called when an element shall get deleted

Parameters
string$tablethe table of the record
int$idthe ID of the record
array$recordThe accordant database record
bool$recordWasDeletedcan be set so that other hooks or
DataHandler$tcemainObjreference to the main tcemain object
Returns
void

Definition at line 157 of file version/Classes/Hook/DataHandlerHook.php.

References $GLOBALS, ArrayUtility\arrayDiffAssocRecursive(), Enumeration\cast(), VersionState\DEFAULT_STATE, VersionState\DELETE_PLACEHOLDER, DataHandler\deleteEl(), DataHandler\deleteL10nOverlayRecords(), elseif, BackendUtility\getLiveVersionOfRecord(), BackendUtility\getMovePlaceholder(), BackendUtility\getWorkspaceVersionOfRecord(), VersionState\MOVE_PLACEHOLDER, VersionState\MOVE_POINTER, DataHandler\newlog(), DataHandlerHook\version_clearWSID(), and DataHandler\versionizeRecord().

rawCopyPageContent (   $oldPageId,
  $newPageId,
array  $copyTablesArray,
DataHandler  $tcemainObj 
)
protected

Copies all records from tables in $copyTablesArray from page with $old_pid to page with $new_pid Uses raw-copy for the operation (meant for versioning!)

Parameters
int$oldPageIdCurrent page id.
int$newPageIdNew page id
array$copyTablesArrayArray of tables from which to copy
DataHandler$tcemainObjTCEmain object
Returns
void
See Also
versionizePages()

Definition at line 1190 of file version/Classes/Hook/DataHandlerHook.php.

References $GLOBALS, DataHandler\copyRecord_raw(), and DataHandler\deleteClause().

Referenced by DataHandlerHook\versionizePages().

updateInlineForeignFieldSorting (   $parentTableName,
  $parentId,
  $foreignTableName,
  $foreignIds,
array  $configuration,
  $targetWorkspaceId 
)

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

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
string$parentTableName
string$parentId
string$foreignTableName
int[]$foreignIds
array$configuration
int$targetWorkspaceId
Returns
void

Definition at line 1098 of file version/Classes/Hook/DataHandlerHook.php.

References DataHandlerHook\$remappedIds, and DataHandlerHook\createRelationHandlerInstance().

version_clearWSID (   $table,
  $id,
  $flush = false,
DataHandler  $tcemainObj 
)
protected

Release version from this workspace (and into "Live" workspace but as an offline version).

Parameters
string$tableTable name
int$idRecord UID
bool$flushIf set, will completely delete element
DataHandler$tcemainObjTCEmain object
Returns
void

Definition at line 1127 of file version/Classes/Hook/DataHandlerHook.php.

References $GLOBALS, Enumeration\cast(), DataHandler\checkRecordUpdateAccess(), VersionState\DELETE_PLACEHOLDER, DataHandler\deleteEl(), BackendUtility\getLiveVersionOfRecord(), BackendUtility\getMovePlaceholder(), BackendUtility\getRecord(), BackendUtility\isTableWorkspaceEnabled(), VersionState\NEW_PLACEHOLDER, and DataHandler\newlog().

Referenced by DataHandlerHook\processCmdmap(), and DataHandlerHook\processCmdmap_deleteAction().

version_setStage (   $table,
  $id,
  $stageId,
  $comment = '',
  $notificationEmailInfo = false,
DataHandler  $tcemainObj,
array  $notificationAlternativeRecipients = array() 
)
protected

Setting stage of record

Parameters
string$tableTable name
int$integerRecord UID
int$stageIdStage ID to set
string$commentComment that goes into log
bool$notificationEmailInfoAccumulate state changes in memory for compiled notification email?
DataHandler$tcemainObjTCEmain object
array$notificationAlternativeRecipientscomma separated list of recipients to notify instead of normal be_users
Returns
void

Definition at line 673 of file version/Classes/Hook/DataHandlerHook.php.

References $GLOBALS, DataHandlerHook\$notificationEmailInfo, DataHandler\checkRecordUpdateAccess(), elseif, BackendUtility\getRecord(), DataHandler\log(), DataHandler\newlog(), and DataHandler\newlog2().

Referenced by DataHandlerHook\processCmdmap().

version_swap_processFields (   $tableName,
  $fieldName,
array  $configuration,
array  $liveData,
array  $versionData,
DataHandler  $dataHandler 
)
protected

Processes fields of a record for the publishing/swapping process. Basically this takes care of IRRE (type "inline") child references.

Parameters
string$tableNameTable name
string$fieldName,:Field name
array$configurationTCA field configuration
array$liveData,:Live record data
array$versionData,:Version record data
DataHandler$dataHandlerCalling data-handler object
Returns
void

Definition at line 1048 of file version/Classes/Hook/DataHandlerHook.php.

References DataHandler\addRemapAction(), DataHandlerHook\createRelationHandlerInstance(), and DataHandler\getInlineFieldType().

versionizePages (   $uid,
  $label,
  $versionizeTree,
DataHandler  $tcemainObj 
)
protected

Creates a new version of a page including content and possible subpages.

Parameters
int$uidPage uid to create new version of.
string$labelVersion label
int$versionizeTreeIndicating "treeLevel" - "page" (0) or "branch" (>=1) ["element" type must call versionizeRecord() directly]
DataHandler$tcemainObjTCEmain object
Returns
void
See Also
copyPages()

Definition at line 720 of file version/Classes/Hook/DataHandlerHook.php.

References $GLOBALS, DataHandler\copyRecord_raw(), DataHandler\doesBranchExist(), DataHandlerHook\getPossibleInlineChildTablesOfParentTable(), DataHandler\int_pageTreeInfo(), DataHandler\newlog(), DataHandlerHook\rawCopyPageContent(), and DataHandler\versionizeRecord().

Referenced by DataHandlerHook\processCmdmap().

writeRemappedForeignField ( \TYPO3\CMS\Core\Database\RelationHandler  $dbAnalysis,
array  $configuration,
  $parentId 
)

Writes remapped foreign field (IRRE).

Parameters
\TYPO3\CMS\Core\Database\RelationHandler$dbAnalysisInstance that holds the sorting order of child records
array$configurationThe TCA field configuration
int$parentIdThe uid of the parent record
Returns
void

Definition at line 1026 of file version/Classes/Hook/DataHandlerHook.php.

Member Data Documentation

$notificationEmailInfo = array()
protected
$remappedIds = array()
protected