DataHandler implements LoggerAwareInterface uses LogDataTrait, LoggerAwareTrait
The main data handler class which takes care of correctly updating and inserting records.
This class was formerly known as TCEmain.
This is the TYPO3 Core Engine class for manipulation of the database This class is used by eg. the tce_db BE route (SimpleDataHandlerController) which provides an interface for POST forms to this class.
Dependencies:
- $GLOBALS['TCA'] must exist
- $GLOBALS['LANG'] must exist
Also see document 'TYPO3 Core API' for details.
Table of Contents
Interfaces
- LoggerAwareInterface
Properties
- $admin : bool
- Will be set if user is admin
- $autoVersionIdMap : array<string, array<int, string>>
- Contains mapping of auto-versionized records.
- $BE_USER : BackendUserAuthentication
- The user-object the script uses. If not set from outside, this is set to the current global $BE_USER.
- $bypassAccessCheckForRecords : bool
- If TRUE, access check, check for deleted etc. for records is bypassed.
- $bypassWorkspaceRestrictions : bool
- If TRUE, workspace restrictions are bypassed on edit and create actions (process_datamap()).
- $callBackObj : object
- Object. Call back object for FlexForm traversal. Useful when external classes wants to use the iteration functions inside DataHandler for traversing a FlexForm structure.
- $checkSimilar : bool
- If TRUE, only fields which are different from the database values are saved! In fact, if a whole input array is similar, it's not saved then.
- $checkStoredRecords : bool
- This will read the record after having updated or inserted it. If anything is not properly submitted an error is written to the log. This feature consumes extra time by selecting records
- $checkStoredRecords_loose : bool
- If set, values '' and 0 will equal each other when the stored records are checked.
- $checkValue_currentRecord : array<string|int, mixed>
- Set to "currentRecord" during checking of values.
- $cmdmap : array<string, array<int|string, array<string|int, mixed>>>
- Set with incoming cmd array
- $copyMappingArray : array<string, array<string|int, mixed>>
- Used by the copy action to track the ids of new pages so subpages are correctly inserted! THIS is internally cleared for each executed copy operation! DO NOT USE THIS FROM OUTSIDE! Read from copyMappingArray_merged instead which is accumulating this information.
- $copyMappingArray_merged : array<string|int, mixed>
- This array is the sum of all copying operations in this class.
- $copyTree : int
- If 0 then branch is NOT copied.
- $copyWhichTables : string
- Comma-separated list. This list of tables decides which tables will be copied. If empty then none will.
- $data_disableFields : array<string|int, mixed>
- If entries are set in this array corresponding to fields for update, they are ignored and thus NOT updated.
- $datamap : array<int|string, array<int|string, array<string|int, mixed>>>
- Set with incoming data array
- $dbAnalysisStore : array<string|int, mixed>
- For accumulation of MM relations that must be written after new records are created.
- $defaultValues : array<string|int, mixed>
- [table][fields]=value: New records are created with default values and you can set this array on the form $defaultValues[$table][$field] = $value to override the default values fetched from TCA.
- $dontProcessTransformations : bool
- If set, then transformations are NOT performed on the input.
- $enableLogging : bool
- If TRUE, actions are logged to sys_log.
- $errorLog : array<string|int, mixed>
- Errors are collected in this variable.
- $isImporting : bool
- If set, then the TCE class has been instantiated during an import action of a T3D
- $neverHideAtCopy : bool
- If set, then the 'hideAtCopy' flag for tables will be ignored.
- $newRelatedIDs : array<string|int, mixed>
- Holds the tables and there the ids of newly created child records from IRRE
- $overrideValues : array<string|int, mixed>
- [table][fields]=value: You can set this array on the form $overrideValues[$table][$field] = $value to override the incoming data. You must set this externally. You must make sure the fields in this array are also found in the table, because it's not checked. All columns can be set by this array!
- $pagetreeNeedsRefresh : bool
- Indicates whether the pagetree needs a refresh because of important changes
- $pagetreeRefreshFieldsFromPages : array<string|int, mixed>
- Fields from the pages-table for which changes will trigger a pagetree refresh
- $registerDBList : array<string, array<int, array<string|int, mixed>>>
- Used for tracking references that might need correction after operations
- $registerDBPids : array<string|int, mixed>
- Used for tracking references that might need correction in pid field after operations (e.g. IRRE)
- $remapStack : array<string|int, mixed>
- Array used for remapping uids and values at the end of process_datamap
- $remapStackRecords : array<string|int, mixed>
- Array used for remapping uids and values at the end of process_datamap (e.g. $remapStackRecords[<table>][<uid>] = <index in $remapStack>)
- $reverseOrder : bool
- If TRUE, the datamap array is reversed in the order, which is a nice thing if you're creating a whole new bunch of records.
- $sortIntervals : int
- The interval between sorting numbers used with tables with a 'sorting' field defined.
- $storeLogMessages : bool
- If TRUE, the default log-messages will be stored. This should not be necessary if the locallang-file for the log-display is properly configured. So disabling this will just save some database-space as the default messages are not saved.
- $substNEWwithIDs : array<string|int, mixed>
- When new elements are created, this array contains a map between their "NEW..." string IDs and the eventual UID they got when stored in database
- $substNEWwithIDs_table : array<string|int, mixed>
- Like $substNEWwithIDs, but where each old "NEW..." id is mapped to the table it was from.
- $suggestedInsertUids : array<string|int, mixed>
- Use this array to validate suggested uids for tables by setting [table]:[uid]. This is a dangerous option since it will force the inserted record to have a certain UID. The value just have to be TRUE, but if you set it to "DELETE" it will make sure any record with that UID will be deleted first (raw delete).
- $userid : int
- Will be set to uid of be_user executing this script
- $username : string
- Will be set to username of be_user executing this script
- $cachePrefixNestedElementCalls : string
- Prefix for the cache entries of nested element calls since the runtimeCache has a global scope.
- $checkModifyAccessListHookObjects : array<string|int, mixed>|null
- $control : array<string|int, mixed>
- Data submitted from the form view, used to control behaviours, e.g. this is used to activate/deactivate fields and thus store NULL values
- $correlationId : CorrelationId|null
- A string which can be used as correlationId for RecordHistory entries.
- $deletedRecords : array<string|int, mixed>
- Per-table array with UIDs that have been deleted.
- $disableDeleteClause : bool
- Disable delete clause
- $excludedTablesAndFields : array<string|int, mixed>
- The list of <table>-<fields> that cannot be edited by user. This is compiled from TCA/exclude-flag combined with non_exclude_fields for the user.
- $historyRecords : array<string|int, mixed>
- List of changed old record ids to new records ids
- $isInWebMount_Cache : array<string|int, mixed>
- Caching array for page ids in webmounts
- $isRecordInWebMount_Cache : array<string|int, mixed>
- Caching array for check of whether records are in a webmount
- $mmHistoryRecords : array<string|int, mixed>
- List of changed old record ids to new records ids
- $outerMostInstance : DataHandler|null
- The outer most instance of \TYPO3\CMS\Core\DataHandling\DataHandler: This object instantiates itself on versioning and localization .
- $pageCache : array<int, array<string, array<string|int, mixed>>>
- Used for caching page records in pageInfo()
- $pagePermissionAssembler : PagePermissionAssembler
- $recInsertAccessCache : array<string|int, mixed>
- User by function checkRecordInsertAccess() to store whether a record can be inserted on a page id
- $recordPidsForDeletedRecords : array<string|int, mixed>
- Internal cache for pids of records which were deleted. It's not possible to retrieve the parent folder/page at a later stage
- $recordsToClearCacheFor : array<string|int, mixed>
- Internal cache for collecting records that should trigger cache clearing
- $referenceIndexUpdater : ReferenceIndexUpdater
- Registry object to gather reference index update requests and perform updates after main processing has been done. The first call to start() instantiates this object.
- $remapStackActions : array<string|int, mixed>
- Array used for executing addition actions after remapping happened (set processRemapStack())
- $remapStackChildIds : array<string|int, mixed>
- Array used for checking whether new children need to be remapped
- $runtimeCache : FrontendInterface
- Runtime Cache to store and retrieve data computed for a single request
- $useTransOrigPointerField : bool
- Will distinguish between translations (with parent) and localizations (without parent) while still using the same methods to copy the records TRUE: translation of a record connected to the default language FALSE: localization of a record without connection to the default language
Methods
- __construct() : mixed
- Sets up the data handler cache and some additional options, the main logic is done in the start() method.
- addRemapAction() : mixed
- Adds an instruction to the remap action stack (used with IRRE).
- canDeletePage() : array<string|int, int>|string
- Used to evaluate if a page can be deleted
- cannotDeleteRecord() : string
- Returns TRUE if record CANNOT be deleted, otherwise FALSE. Used to check before the versioning API allows a record to be marked for deletion.
- checkModifyAccessList() : bool
- Checking group modify_table access list
- checkRecordInsertAccess() : bool
- Checks if user may insert a record from $insertTable on $pid
- checkRecordUpdateAccess() : bool
- Checks if user may update a record with uid=$id from $table
- checkStoredRecord() : array<string|int, mixed>|null
- Checking stored record to see if the written values are properly updated.
- checkValue() : array<string|int, mixed>
- Evaluates a value according to $table/$field settings.
- checkValue_category_processDBdata() : array<string|int, mixed>
- Returns processed data for category fields
- checkValue_checkMax() : array<string|int, mixed>
- Checks if a fields has more items than defined via TCA in maxitems.
- checkValue_flex_procInData() : array<string|int, mixed>
- Starts the processing the input data for flexforms. This will traverse all sheets / languages and for each it will traverse the sub-structure.
- checkValue_flex_procInData_travDS() : mixed
- Processing of the sheet/language data array When it finds a field with a value the processing is done by ->checkValue_SW() by default but if a call back function name is given that method in this class will be called for the processing instead.
- checkValue_flexArray2Xml() : string
- Converts an array to FlexForm XML
- checkValue_group_select_explodeSelectGroupValue() : array<string|int, mixed>
- Explodes the $value, which is a list of files/uids (group select)
- checkValue_group_select_processDBdata() : array<string|int, mixed>
- Returns data for group/db and select fields
- checkValue_inline() : mixed
- Evaluates 'inline' type values.
- checkValue_input_Eval() : array<string|int, mixed>
- Evaluation of 'input'-type values based on 'eval' list
- checkValue_SW() : array<string|int, mixed>
- Branches out evaluation of a field value based on its type as configured in $GLOBALS['TCA'] Can be called for FlexForm pseudo fields as well, BUT must not have $field set if so.
- checkValue_text_Eval() : array<string|int, mixed>
- checkValueForInline() : array<string|int, mixed>|false
- Evaluates 'inline' type values.
- clear_cacheCmd() : mixed
- Clears the cache based on the command $cacheCmd.
- clearPrefixFromValue() : string
- Removes the prependAtCopy prefix on values
- compareFieldArrayWithCurrentAndUnset() : array<string|int, mixed>
- Compares the incoming field array with the current record and unsets all fields which are the same.
- compileAdminTables() : array<string|int, mixed>
- List of all tables (those administrators has access to = array_keys of $GLOBALS['TCA'])
- copyL10nOverlayRecords() : mixed
- Find l10n-overlay records and perform the requested copy action for these records.
- copyPages() : mixed
- Copying pages Main function for copying pages.
- copyRecord() : int|null
- Copying a single record
- copyRecord_flexFormCallBack() : array<string|int, mixed>
- Callback function for traversing the FlexForm structure in relation to creating copied files of file relations inside of flex form structures.
- copyRecord_procBasedOnFieldType() : array<string|int, mixed>|string|null
- Processing/Preparing content for copyRecord() function
- copyRecord_raw() : int|null
- Copying records, but makes a "raw" copy of a record.
- copySpecificPage() : int|null
- Copying a single page ($uid) to $destPid and all tables in the array copyTablesArray.
- dbAnalysisStoreExec() : mixed
- Executing dbAnalysisStore This will save MM relations for new records but is executed after records are created because we need to know the ID of them
- deleteAction() : mixed
- Delete a single record
- deleteClause() : string
- Returns delete-clause for the $table
- deleteEl() : mixed
- Delete element from any table
- deleteL10nOverlayRecords() : mixed
- Find l10n-overlay records and perform the requested delete action for these records.
- deletePages() : mixed
- Used to delete page because it will check for branch below pages and disallowed tables on the page as well.
- deleteRecord() : mixed
- Deleting a record This function may not be used to delete pages-records unless the underlying records are already deleted Deletes a record regardless of versioning state (live or offline, doesn't matter, the uid decides) If both $noRecordCheck and $forceHardDelete are set it could even delete a "deleted"-flagged record!
- deleteRecord_procBasedOnFieldType() : void
- Process fields of a record to be deleted and search for special handling, like inline type, MM records, etc.
- deleteRecord_procFields() : mixed
- Before a record is deleted, check if it has references such as inline type or MM references.
- deleteSpecificPage() : mixed
- Delete a page (or set deleted field to 1) and all records on it.
- destNotInsideSelf() : bool
- Checks if page $id is a uid in the rootline of page id $destinationId Used when moving a page
- disableDeleteClause() : mixed
- Disables the delete clause for fetching records.
- discard() : void
- Discard a versioned record from this workspace. This deletes records from the database - no soft delete.
- doesBranchExist() : string|int
- Checks if a whole branch of pages exists
- doesPageHaveUnallowedTables() : bool|array<string|int, mixed>
- Checks if there are records on a page from tables that are not allowed
- doesRecordExist() : bool
- Checks if record can be selected based on given permission criteria
- eventPid() : int
- fillInFieldArray() : array<string|int, mixed>
- Filling in the field array $this->excludedTablesAndFields is used to filter fields if needed.
- fixCopyAfterDuplFields() : array<string|int, mixed>
- When er record is copied you can specify fields from the previous record which should be copied into the new one This function is also called with new elements. But then $update must be set to zero and $newData containing the data array. In that case data in the incoming array is NOT overridden. (250202)
- fixUniqueInPid() : mixed
- Checks if any uniqueInPid eval input fields are in the record and if so, they are re-written to be correct.
- getAutoVersionId() : int|null
- Gets the automatically versionized id of a record.
- getCopyHeader() : string
- Get modified header for a copied record
- getCorrelationId() : CorrelationId|null
- getExcludeListArray() : array<string|int, mixed>
- Generate an array of fields to be excluded from editing for the user. Based on "exclude"-field in TCA and a look up in non_exclude_fields Will also generate this list for admin-users so they must be check for before calling the function
- getHistoryRecords() : array<string|int, mixed>
- getInlineFieldType() : string|bool
- Returns the subtype as a string of an inline field.
- getPID() : int|false
- Returns the pid of a record from $table with $uid
- getRecordProperties() : array<string|int, mixed>
- Returns an array with record properties, like header and pid No check for deleted or access is done! For versionized records, pid is resolved to its live versions pid.
- getRecordPropertiesFromRow() : array<string|int, mixed>|null
- Returns an array with record properties, like header and pid, based on the row
- getRecordsWithSameValue() : array<string|int, mixed>
- gets all records that have the same value in a field excluding the given uid
- getSortNumber() : int|array<string|int, mixed>|bool|null
- Returning sorting number for tables with a "sortby" column Using when new records are created and existing records are moved around.
- getTableEntries() : array<string|int, mixed>
- Extract entries from TSconfig for a specific table. This will merge specific and default configuration together.
- getUnique() : string
- Gets a unique value for $table/$id/$field based on $value
- getVersionizedIncomingFieldArray() : void
- If a parent record was versionized on a workspace in $this->process_datamap, it might be possible, that child records (e.g. on using IRRE) were affected.
- hasDeletedRecord() : bool
- Determines whether a particular record has been deleted using DataHandler::deleteRecord() in this instance.
- hook_processDatamap_afterDatabaseOperations() : mixed
- Hook: processDatamap_afterDatabaseOperations (calls $hookObj->processDatamap_afterDatabaseOperations($status, $table, $id, $fieldArray, $this);)
- insertDB() : int|null
- Insert into database Does not check permissions but expects them to be verified on beforehand
- insertNewCopyVersion() : int|null
- Inserts a record in the database, passing TCA configuration values through checkValue() but otherwise does NOTHING and checks nothing regarding permissions.
- insertUpdateDB_preprocessBasedOnFieldType() : array<string|int, mixed>
- Preprocesses field array based on field type. Some fields must be adjusted before going to database. This is done on the copy of the field array because original values are used in remap action later.
- int_pageTreeInfo() : array<string|int, mixed>
- Returns array, $CPtable, of pages under the $pid going down to $counter levels.
- isInWebMount() : bool
- Checks if the input page ID is in the BE_USER webmounts
- isOuterMostInstance() : bool
- Determines whether the this object is the outer most instance of itself Since DataHandler can create nested objects of itself, this method helps to determine the first (= outer most) one.
- isRecordCopied() : bool
- Determine if a record was copied or if a record is the result of a copy action.
- isRecordInWebMount() : bool
- Checking if a record with uid $id from $table is in the BE_USERS webmounts which is required for editing etc.
- isReferenceField() : bool
- Returns TRUE if the TCA/columns field type is a DB reference field
- isTableAllowedForThisPage() : bool
- Checks if a table is allowed on a certain page id according to allowed tables set for the page "doktype" and its [ctrl][rootLevel]-settings if any.
- localize() : int|bool
- Localizes a record to another system language
- log() : int
- Logging actions from DataHandler
- moveL10nOverlayRecords() : mixed
- Find l10n-overlay records and perform the requested move action for these records.
- moveRecord() : mixed
- Moving single records
- moveRecord_procBasedOnFieldType() : mixed
- Move child records depending on the field type of the parent record.
- moveRecord_procFields() : mixed
- Walk through all fields of the moved record and look for children of e.g. the inline type.
- moveRecord_raw() : mixed
- Moves a record without checking security of any sort.
- newFieldArray() : array<string|int, mixed>
- Returns a fieldArray with default values. Values will be picked up from the TCA array looking at the config key "default" for each column. If values are set in ->defaultValues they will overrule though.
- overrideFieldArray() : array<string|int, mixed>
- Returns the $data array from $table overridden in the fields defined in ->overrideValues.
- pageInfo() : string
- Returns the value of the $field from page $id NOTICE; the function caches the result for faster delivery next time. You can use this function repeatedly without performance loss since it doesn't look up the same record twice!
- prependLabel() : string
- Return "copy" label for a table. Although the name is "prepend" it actually APPENDs the label (after ...)
- printLogErrorMessages() : mixed
- Print log error messages from the operations of this script instance
- process_cmdmap() : void|bool
- Processing the cmd-array See "TYPO3 Core API" for a description of the options.
- process_datamap() : bool|void
- Processing the data-array Call this function to process the data-array set by start()
- processRemapStack() : mixed
- Processes the $this->remapStack at the end of copying, inserting, etc. actions.
- recordInfo() : array<string|int, mixed>|null
- Returns the row of a record given by $table and $id and $fieldList (list of fields, may be '*') NOTICE: No check for deleted or access!
- registerRecordIdForPageCacheClearing() : mixed
- Clearing the cache based on a page being updated If the $table is 'pages' then cache is cleared for all pages on the same level (and subsequent?) Else just clear the cache for the parent page of the record.
- registerReferenceIndexRowsForDrop() : void
- Delete rows from sys_refindex a table / uid combination is involved in: Either on left side (tablename + recuid) OR right side (ref_table + ref_uid).
- registerReferenceIndexUpdateForReferencesToItem() : void
- Helper method to access referenceIndexUpdater->registerUpdateForReferencesToItem() from within workspace DataHandlerHook.
- remapListedDBRecords() : mixed
- Processes the fields with references as registered during the copy process. This includes all FlexForm fields which had references.
- remapListedDBRecords_flexFormCallBack() : array<string|int, mixed>
- Callback function for traversing the FlexForm structure in relation to creating copied files of file relations inside of flex form structures.
- remapListedDBRecords_procDBRefs() : array<string|int, mixed>|null
- Performs remapping of old UID values to NEW uid values for a DB reference field.
- remapListedDBRecords_procInline() : mixed
- Performs remapping of old UID values to NEW uid values for an inline field.
- resolvePid() : int
- Get the final pid based on $table and $pid ($destPid type... pos/neg)
- setControl() : mixed
- setCorrelationId() : void
- setDefaultsFromUserTS() : mixed
- Initializes default values coming from User TSconfig
- setHistory() : mixed
- Setting sys_history record, based on content previously set in $this->historyRecords[$table . ':' . $id] (by compareFieldArrayWithCurrentAndUnset())
- setMirror() : mixed
- Function that can mirror input values in datamap-array to other uid numbers.
- start() : mixed
- Initializing.
- tableAdminOnly() : bool
- Checks if the $table is only editable by admin-users
- tableReadOnly() : bool
- Checks if the $table is readOnly
- updateDB() : mixed
- Update database record Does not check permissions but expects them to be verified on beforehand
- updateRefIndex() : void
- Register a table/uid combination in current user workspace for reference updating.
- versionizeRecord() : int|null
- Creates a new version of a record (Requires support in the table)
- versionPublishManyToManyRelations() : void
- Handle MM relations attached to a record when publishing a workspace record.
- workspaceCannotEditOfflineVersion() : string
- Evaluates if a user is allowed to edit the offline version
- workspaceCannotEditRecord() : string
- Checking if editing of an existing record is allowed in current workspace if that is offline.
- _ACTION_FLEX_FORMdata() : mixed
- Actions for flex form element (move, delete) allows to remove and move flexform sections
- addDefaultPermittedLanguageIfNotSet() : void
- If a "languageField" is specified for $table this function will add a possible value to the incoming array if none is found in there already.
- addDeleteRestriction() : mixed
- Add delete restriction if not disabled
- addNewValuesToRemapStackChildIds() : mixed
- Adds new values to the remapStackChildIds array.
- applyDefaultsForFieldArray() : array<string|int, mixed>
- When a new record is created, all values that haven't been set but are set via PageTSconfig / UserTSconfig get applied here.
- applyFiltersToValues() : array<string|int, mixed>|mixed
- Applies the filter methods from a column's TCA configuration to a value array.
- castReferenceValue() : int|string
- Casts a reference value. In case MM relations or foreign_field references are used. All other configurations, as well as foreign_table(!) could be stored as comma-separated-values as well. Since the system is not able to determine the default value automatically then, the TCA default value is used if it has been defined.
- checkForRecordsFromDisallowedTables() : array<string|int, string>|null
- Check if there are records from tables on the pages to be deleted which the current user is not allowed to
- checkValue_inline_processDBdata() : string
- Returns data for inline fields.
- checkValue_input_ValidateEmail() : mixed
- If $value is not a valid e-mail address, $set will be set to false and a flash error message will be added
- checkValueForCategory() : array<string|int, mixed>
- Evaluate 'category' type values
- checkValueForCheck() : array<string|int, mixed>
- Evaluates 'check' type values.
- checkValueForFlex() : array<string|int, mixed>
- Evaluates 'flex' type values.
- checkValueForGroupSelect() : array<string|int, mixed>
- Evaluates 'group' or 'select' type values.
- checkValueForInput() : array<string|int, mixed>
- Evaluate "input" type values.
- checkValueForInternalReferences() : array<string|int, mixed>
- Checks values that are used for internal references. If the provided $value is a NEW-identifier, the direct processing is stopped. Instead, the value is forwarded to the remap-stack to be post-processed and resolved into a proper UID after all data has been resolved.
- checkValueForLanguage() : array<string|int, mixed>
- Evaluate "language" type value.
- checkValueForRadio() : array<string|int, mixed>
- Evaluates 'radio' type values.
- checkValueForSlug() : array<string|int, mixed>
- Evaluate "slug" type values.
- checkValueForText() : array<string|int, mixed>
- Evaluate "text" type values.
- controlActiveElements() : mixed
- Controls active elements and sets NULL values if not active.
- copy_remapTranslationSourceField() : mixed
- Remap languageSource field to uids of newly created records
- copyRecord_processInline() : string
- Processes child records in an inline (IRRE) element when the parent record is copied.
- copyRecord_processManyToMany() : string
- Processes the children of an MM relation field (select, group, inline) when the parent record is copied.
- createRelationHandlerInstance() : RelationHandler
- discardCsvReferencesToRecord() : void
- When the to-discard record is the target of a CSV group field of another table record, these records need to be updated to no longer point to the discarded record.
- discardLocalizationOverlayRecords() : void
- Find localization overlays of a record and discard them.
- discardLocalizedWorkspaceVersionsOfRecord() : void
- When deleting a live element with sys_language_uid = 0, there may be translated records that have been created in workspaces only (t3ver_state=1). Those have to be discarded explicitly since the other 'delete' related code does not consider this case, otherwise the 'new' workspace translation would be dangling when the live record is gone.
- discardMmRelations() : void
- When a workspace record row is discarded that has mm relations, existing mm table rows need to be deleted. The method performs the delete operation depending on TCA field configuration.
- discardRecordRelations() : void
- Discard record relations like inline and MM of a record.
- discardSubPagesAndRecordsOnPage() : void
- Also discard any sub pages and records of a new parent page if this page is discarded.
- discardWorkspaceVersionsOfRecord() : void
- Discard workspace overlays of a live record: When a live row is deleted, all existing workspace overlays are discarded.
- doesRecordExist_pageLookUp() : bool|array<string|int, mixed>
- Looks up a page based on permissions.
- fixUniqueInSite() : bool
- Checks if any uniqueInSite eval fields are in the record and if so, they are re-written to be correct.
- fixUniqueInSiteForSubpages() : mixed
- Check if there are subpages that need an adoption as well
- formatLogDetails() : string
- Replaces a string with placeholders (%s or {myPlaceholder}) with its substitutes.
- formatLogDetailsStatic() : string
- Static version for ViewHelpers etc.
- getAllowedTablesToCopyWhenCopyingAPage() : array<string|int, mixed>
- Compile a list of tables that should be copied along when a page is about to be copied.
- getCacheManager() : CacheManager
- Create and returns an instance of the CacheManager
- getCheckModifyAccessListHookObjects() : array<string|int, mixed>
- Gets the 'checkModifyAccessList' hook objects.
- getCommandMapElements() : array<string|int, mixed>
- Gets elements of the command map that match a particular command.
- getDefaultLanguagePageId() : int
- Find out if the record is a localization. If so, get the uid of the default language page.
- getFieldEvalCacheIdentifier() : string
- Return the cache entry identifier for field evals
- getLanguageService() : LanguageService
- getLocalTCE() : DataHandler
- Returns an instance of DataHandler for handling local datamaps/cmdmaps
- getOriginalParentOfRecord() : array<string|int, int>
- Gets UID of parent record. If record is deleted it will be looked up in an array built before the record was deleted
- getOuterMostInstance() : DataHandler
- Gets the outer most instance of \TYPO3\CMS\Core\DataHandling\DataHandler Since \TYPO3\CMS\Core\DataHandling\DataHandler can create nested objects of itself, this method helps to determine the first (= outer most) one.
- getPreviousLocalizedRecordUid() : int
- Returning uid of "previous" localized record, if any, for tables with a "sortby" column.
- getRecordHistoryStore() : RecordHistoryStore
- getResourceFactory() : ResourceFactory
- Gets the resourceFactory
- getRuntimeCache() : FrontendInterface
- Gets an instance of the runtime cache.
- getSiteLanguageForPage() : SiteLanguage|null
- Find a site language by the given language ID for a specific page, and check for all available sites if the page ID is "0".
- getUniqueCountStatement() : QueryBuilder
- Gets the count of records for a unique field
- hardDeleteSingleRecord() : void
- Simple helper method to hard delete one row from table ignoring delete TCA field
- increaseSortingOfFollowingRecords() : void
- Increases sorting field value of all records with sorting higher than $sortingValue
- inlineLocalizeSynchronize() : mixed
- Performs localization or synchronization of child records.
- isElementToBeDeleted() : bool
- Determines whether an element was registered to be deleted in the registry.
- isNestedElementCallRegistered() : bool
- Determines nested element calls.
- isRecordLocalized() : bool
- Returns true if a localization of a record exists.
- isSubmittedValueEqualToStoredValue() : bool
- Determines whether submitted values and stored values are equal.
- normalizeTimeFormat() : string
- overlayAutoVersionId() : int
- Overlays the automatically versionized id of a record.
- postProcessDatabaseInsert() : int
- Entry point to post process a database insert. Currently bails early unless a UID has been forced and the database platform is not MySQL.
- postProcessPostgresqlInsert() : mixed
- PostgreSQL works with sequences for auto increment columns. A sequence is not updated when a value is written to such a column. To avoid clashes when the sequence returns an existing ID this helper will update the sequence to the current max value of the column.
- postProcessSqlServerInsert() : int
- Get the last insert ID from sql server
- prepareCacheFlush() : array<string|int, mixed>
- Prepare the cache clearing
- processClearCacheQueue() : mixed
- Do the actual clear cache
- recordInfoWithPermissionCheck() : array<string, mixed>|false
- Checks if record exists with and without permission check and returns that row
- registerElementsToBeDeleted() : mixed
- Registers elements to be deleted in the registry.
- registerNestedElementCall() : mixed
- Registers nested elements calls.
- resetElementsToBeDeleted() : mixed
- Resets the elements to be deleted in the registry.
- resetNestedElementCalls() : mixed
- Resets the nested element calls.
- resolveFieldConfigurationAndRespectColumnsOverrides() : array<string|int, mixed>
- Use columns overrides for evaluation.
- resolveSortingAndPidForNewRecord() : array<string|int, mixed>
- Sets the "sorting" DB field and the "pid" field of an incoming record that should be added (NEW1234) depending on the record that should be added or where it should be added.
- resolveVersionedRecords() : array<string|int, mixed>
- Resolves versioned records for the current workspace scope.
- setNullValues() : mixed
- Sets NULL values in haystack array.
- undeleteRecord() : void
- Restore live records by setting soft-delete flag to 0.
- undeleteRecordRelations() : void
- Check if a to-restore record has inline references and restore them.
- unserializeLogData() : array<string|int, mixed>|null
- Useful for handling old serialized data, which might have been migrated to JSON encoded properties already.
- unsetElementsToBeDeleted() : array<string|int, mixed>
- Unsets elements (e.g. of the data map) that shall be deleted.
- updateFlexFormData() : mixed
- Updates FlexForm data.
- workspaceAllowAutoCreation() : bool
- Evaluates if auto creation of a version of a record is allowed.
Properties
$admin
Will be set if user is admin
public
bool
$admin
should only be used from within TYPO3 Core
$autoVersionIdMap
Contains mapping of auto-versionized records.
public
array<string, array<int, string>>
$autoVersionIdMap
= []
should only be used from within TYPO3 Core
$BE_USER
The user-object the script uses. If not set from outside, this is set to the current global $BE_USER.
public
BackendUserAuthentication
$BE_USER
$bypassAccessCheckForRecords
If TRUE, access check, check for deleted etc. for records is bypassed.
public
bool
$bypassAccessCheckForRecords
= false
YOU MUST KNOW what you are doing if you use this feature!
$bypassWorkspaceRestrictions
If TRUE, workspace restrictions are bypassed on edit and create actions (process_datamap()).
public
bool
$bypassWorkspaceRestrictions
= false
YOU MUST KNOW what you do if you use this feature!
should only be used from within TYPO3 Core
$callBackObj
Object. Call back object for FlexForm traversal. Useful when external classes wants to use the iteration functions inside DataHandler for traversing a FlexForm structure.
public
object
$callBackObj
should only be used from within TYPO3 Core
$checkSimilar
If TRUE, only fields which are different from the database values are saved! In fact, if a whole input array is similar, it's not saved then.
public
bool
$checkSimilar
= true
should only be used from within TYPO3 Core
$checkStoredRecords
This will read the record after having updated or inserted it. If anything is not properly submitted an error is written to the log. This feature consumes extra time by selecting records
public
bool
$checkStoredRecords
= true
$checkStoredRecords_loose
If set, values '' and 0 will equal each other when the stored records are checked.
public
bool
$checkStoredRecords_loose
= true
$checkValue_currentRecord
Set to "currentRecord" during checking of values.
public
array<string|int, mixed>
$checkValue_currentRecord
= []
$cmdmap
Set with incoming cmd array
public
array<string, array<int|string, array<string|int, mixed>>>
$cmdmap
= []
$copyMappingArray
Used by the copy action to track the ids of new pages so subpages are correctly inserted! THIS is internally cleared for each executed copy operation! DO NOT USE THIS FROM OUTSIDE! Read from copyMappingArray_merged instead which is accumulating this information.
public
array<string, array<string|int, mixed>>
$copyMappingArray
= []
NOTE: This is used by some outside scripts (e.g. hooks), as the results in $copyMappingArray_merged are only available after an action has been completed.
$copyMappingArray_merged
This array is the sum of all copying operations in this class.
public
array<string|int, mixed>
$copyMappingArray_merged
= []
should only be used from within TYPO3 Core
$copyTree
If 0 then branch is NOT copied.
public
int
$copyTree
= 0
If 1 then pages on the 1st level is copied. If 2 then pages on the second level is copied ... and so on
$copyWhichTables
Comma-separated list. This list of tables decides which tables will be copied. If empty then none will.
public
string
$copyWhichTables
= '*'
If '*' then all will (that the user has permission to of course)
should only be used from within TYPO3 Core
$data_disableFields
If entries are set in this array corresponding to fields for update, they are ignored and thus NOT updated.
public
array<string|int, mixed>
$data_disableFields
= []
You could set this array from a series of checkboxes with value=0 and hidden fields before the checkbox with 1. Then an empty checkbox will disable the field.
should only be used from within TYPO3 Core
$datamap
Set with incoming data array
public
array<int|string, array<int|string, array<string|int, mixed>>>
$datamap
= []
$dbAnalysisStore
For accumulation of MM relations that must be written after new records are created.
public
array<string|int, mixed>
$dbAnalysisStore
= []
$defaultValues
[table][fields]=value: New records are created with default values and you can set this array on the form $defaultValues[$table][$field] = $value to override the default values fetched from TCA.
public
array<string|int, mixed>
$defaultValues
= []
If ->setDefaultsFromUserTS is called UserTSconfig default values will overrule existing values in this array (thus UserTSconfig overrules externally set defaults which overrules TCA defaults)
should only be used from within TYPO3 Core
$dontProcessTransformations
If set, then transformations are NOT performed on the input.
public
bool
$dontProcessTransformations
= false
$enableLogging
If TRUE, actions are logged to sys_log.
public
bool
$enableLogging
= true
$errorLog
Errors are collected in this variable.
public
array<string|int, mixed>
$errorLog
= []
should only be used from within TYPO3 Core
$isImporting
If set, then the TCE class has been instantiated during an import action of a T3D
public
bool
$isImporting
= false
$neverHideAtCopy
If set, then the 'hideAtCopy' flag for tables will be ignored.
public
bool
$neverHideAtCopy
= false
$newRelatedIDs
Holds the tables and there the ids of newly created child records from IRRE
public
array<string|int, mixed>
$newRelatedIDs
= []
should only be used from within TYPO3 Core
$overrideValues
[table][fields]=value: You can set this array on the form $overrideValues[$table][$field] = $value to override the incoming data. You must set this externally. You must make sure the fields in this array are also found in the table, because it's not checked. All columns can be set by this array!
public
array<string|int, mixed>
$overrideValues
= []
should only be used from within TYPO3 Core
$pagetreeNeedsRefresh
Indicates whether the pagetree needs a refresh because of important changes
public
bool
$pagetreeNeedsRefresh
= false
should only be used from within TYPO3 Core
$pagetreeRefreshFieldsFromPages
Fields from the pages-table for which changes will trigger a pagetree refresh
public
array<string|int, mixed>
$pagetreeRefreshFieldsFromPages
= ['pid', 'sorting', 'deleted', 'hidden', 'title', 'doktype', 'is_siteroot', 'fe_group', 'nav_hide', 'nav_title', 'module', 'starttime', 'endtime', 'content_from_pid', 'extendToSubpages']
$registerDBList
Used for tracking references that might need correction after operations
public
array<string, array<int, array<string|int, mixed>>>
$registerDBList
= []
$registerDBPids
Used for tracking references that might need correction in pid field after operations (e.g. IRRE)
public
array<string|int, mixed>
$registerDBPids
= []
$remapStack
Array used for remapping uids and values at the end of process_datamap
public
array<string|int, mixed>
$remapStack
= []
$remapStackRecords
Array used for remapping uids and values at the end of process_datamap (e.g. $remapStackRecords[<table>][<uid>] = <index in $remapStack>)
public
array<string|int, mixed>
$remapStackRecords
= []
$reverseOrder
If TRUE, the datamap array is reversed in the order, which is a nice thing if you're creating a whole new bunch of records.
public
bool
$reverseOrder
= false
$sortIntervals
The interval between sorting numbers used with tables with a 'sorting' field defined.
public
int
$sortIntervals
= 256
Min 1, should be power of 2
should only be used from within TYPO3 Core
$storeLogMessages
If TRUE, the default log-messages will be stored. This should not be necessary if the locallang-file for the log-display is properly configured. So disabling this will just save some database-space as the default messages are not saved.
public
bool
$storeLogMessages
= true
$substNEWwithIDs
When new elements are created, this array contains a map between their "NEW..." string IDs and the eventual UID they got when stored in database
public
array<string|int, mixed>
$substNEWwithIDs
= []
$substNEWwithIDs_table
Like $substNEWwithIDs, but where each old "NEW..." id is mapped to the table it was from.
public
array<string|int, mixed>
$substNEWwithIDs_table
= []
should only be used from within TYPO3 Core
$suggestedInsertUids
Use this array to validate suggested uids for tables by setting [table]:[uid]. This is a dangerous option since it will force the inserted record to have a certain UID. The value just have to be TRUE, but if you set it to "DELETE" it will make sure any record with that UID will be deleted first (raw delete).
public
array<string|int, mixed>
$suggestedInsertUids
= []
The option is used for import of T3D files when synchronizing between two mirrored servers. As a security measure this feature is available only for Admin Users (for now)
$userid
Will be set to uid of be_user executing this script
public
int
$userid
should only be used from within TYPO3 Core
$username
Will be set to username of be_user executing this script
public
string
$username
should only be used from within TYPO3 Core
$cachePrefixNestedElementCalls
Prefix for the cache entries of nested element calls since the runtimeCache has a global scope.
protected
string
$cachePrefixNestedElementCalls
= 'core-datahandler-nestedElementCalls-'
$checkModifyAccessListHookObjects
protected
array<string|int, mixed>|null
$checkModifyAccessListHookObjects
$control
Data submitted from the form view, used to control behaviours, e.g. this is used to activate/deactivate fields and thus store NULL values
protected
array<string|int, mixed>
$control
= []
$correlationId
A string which can be used as correlationId for RecordHistory entries.
protected
CorrelationId|null
$correlationId
The string can later be used to rollback multiple changes at once.
$deletedRecords
Per-table array with UIDs that have been deleted.
protected
array<string|int, mixed>
$deletedRecords
= []
$disableDeleteClause
Disable delete clause
protected
bool
$disableDeleteClause
= false
$excludedTablesAndFields
The list of <table>-<fields> that cannot be edited by user. This is compiled from TCA/exclude-flag combined with non_exclude_fields for the user.
protected
array<string|int, mixed>
$excludedTablesAndFields
= []
$historyRecords
List of changed old record ids to new records ids
protected
array<string|int, mixed>
$historyRecords
= []
$isInWebMount_Cache
Caching array for page ids in webmounts
protected
array<string|int, mixed>
$isInWebMount_Cache
= []
$isRecordInWebMount_Cache
Caching array for check of whether records are in a webmount
protected
array<string|int, mixed>
$isRecordInWebMount_Cache
= []
$mmHistoryRecords
List of changed old record ids to new records ids
protected
array<string|int, mixed>
$mmHistoryRecords
= []
$outerMostInstance
The outer most instance of \TYPO3\CMS\Core\DataHandling\DataHandler: This object instantiates itself on versioning and localization .
protected
DataHandler|null
$outerMostInstance
..
$pageCache
Used for caching page records in pageInfo()
protected
array<int, array<string, array<string|int, mixed>>>
$pageCache
= []
$pagePermissionAssembler
protected
PagePermissionAssembler
$pagePermissionAssembler
$recInsertAccessCache
User by function checkRecordInsertAccess() to store whether a record can be inserted on a page id
protected
array<string|int, mixed>
$recInsertAccessCache
= []
$recordPidsForDeletedRecords
Internal cache for pids of records which were deleted. It's not possible to retrieve the parent folder/page at a later stage
protected
static array<string|int, mixed>
$recordPidsForDeletedRecords
= []
$recordsToClearCacheFor
Internal cache for collecting records that should trigger cache clearing
protected
static array<string|int, mixed>
$recordsToClearCacheFor
= []
$referenceIndexUpdater
Registry object to gather reference index update requests and perform updates after main processing has been done. The first call to start() instantiates this object.
protected
ReferenceIndexUpdater
$referenceIndexUpdater
Recursive sub instances receive this instance via __construct(). The final update() call is done at the end of process_cmdmap() or process_datamap() in the outer most instance.
$remapStackActions
Array used for executing addition actions after remapping happened (set processRemapStack())
protected
array<string|int, mixed>
$remapStackActions
= []
$remapStackChildIds
Array used for checking whether new children need to be remapped
protected
array<string|int, mixed>
$remapStackChildIds
= []
$runtimeCache
Runtime Cache to store and retrieve data computed for a single request
protected
FrontendInterface
$runtimeCache
$useTransOrigPointerField
Will distinguish between translations (with parent) and localizations (without parent) while still using the same methods to copy the records TRUE: translation of a record connected to the default language FALSE: localization of a record without connection to the default language
protected
bool
$useTransOrigPointerField
= true
Methods
__construct()
Sets up the data handler cache and some additional options, the main logic is done in the start() method.
public
__construct([ReferenceIndexUpdater|null $referenceIndexUpdater = null ]) : mixed
Parameters
- $referenceIndexUpdater : ReferenceIndexUpdater|null = null
-
Hand over from outer most instance to sub instances
addRemapAction()
Adds an instruction to the remap action stack (used with IRRE).
public
addRemapAction(string $table, int|string $id, callable $callback, array<string|int, mixed> $arguments) : mixed
Parameters
- $table : string
-
The affected table
- $id : int|string
-
The affected ID
- $callback : callable
-
The callback information (object and method)
- $arguments : array<string|int, mixed>
-
The arguments to be used with the callback
should only be used from within DataHandler
canDeletePage()
Used to evaluate if a page can be deleted
public
canDeletePage(int $uid) : array<string|int, int>|string
Parameters
- $uid : int
-
Page id
should only be used from within DataHandler
Return values
array<string|int, int>|string —If array: List of page uids to traverse and delete (means OK), if string: error message.
cannotDeleteRecord()
Returns TRUE if record CANNOT be deleted, otherwise FALSE. Used to check before the versioning API allows a record to be marked for deletion.
public
cannotDeleteRecord(string $table, int $id) : string
Parameters
- $table : string
-
Record Table
- $id : int
-
Record UID
should only be used from within DataHandler
Return values
string —Returns a string IF there is an error (error string explaining). FALSE means record can be deleted
checkModifyAccessList()
Checking group modify_table access list
public
checkModifyAccessList(string $table) : bool
Parameters
- $table : string
-
Table name
should only be used from within DataHandler
Return values
bool —Returns TRUE if the user has general access to modify the $table
checkRecordInsertAccess()
Checks if user may insert a record from $insertTable on $pid
public
checkRecordInsertAccess(string $insertTable, int $pid[, int $action = SystemLogDatabaseAction::INSERT ]) : bool
Parameters
- $insertTable : string
-
Tablename to check
- $pid : int
-
Integer PID
- $action : int = SystemLogDatabaseAction::INSERT
-
For logging: Action number.
should only be used from within DataHandler
Return values
bool —Returns TRUE if the user may insert a record from table $insertTable on page $pid
checkRecordUpdateAccess()
Checks if user may update a record with uid=$id from $table
public
checkRecordUpdateAccess(string $table, int $id[, array<string|int, mixed>|bool $data = false ][, array<string|int, mixed> $hookObjectsArr = null ]) : bool
Parameters
- $table : string
-
Record table
- $id : int
-
Record UID
- $data : array<string|int, mixed>|bool = false
-
Record data
- $hookObjectsArr : array<string|int, mixed> = null
-
Hook objects
should only be used from within DataHandler
Return values
bool —Returns TRUE if the user may update the record given by $table and $id
checkStoredRecord()
Checking stored record to see if the written values are properly updated.
public
checkStoredRecord(string $table, int $id, array<string|int, mixed> $fieldArray, int $action) : array<string|int, mixed>|null
Parameters
- $table : string
-
Record table name
- $id : int
-
Record uid
- $fieldArray : array<string|int, mixed>
-
Array of field=>value pairs to insert/update
- $action : int
-
Action, for logging only.
should only be used from within DataHandler
Tags
Return values
array<string|int, mixed>|null —Selected row
checkValue()
Evaluates a value according to $table/$field settings.
public
checkValue(string $table, string $field, string $value, int|string $id, string $status, int $realPid, int $tscPID[, array<string|int, mixed> $incomingFieldArray = [] ]) : array<string|int, mixed>
This function is for real database fields - NOT FlexForm "pseudo" fields. NOTICE: Calling this function expects this: 1) That the data is saved!
Parameters
- $table : string
-
Table name
- $field : string
-
Field name
- $value : string
-
Value to be evaluated. Notice, this is the INPUT value from the form. The original value (from any existing record) must be manually looked up inside the function if needed - or taken from $currentRecord array.
- $id : int|string
-
The record-uid, mainly - but not exclusively - used for logging
- $status : string
-
'update' or 'new' flag
- $realPid : int
-
The real PID value of the record. For updates, this is just the pid of the record. For new records this is the PID of the page where it is inserted.
- $tscPID : int
-
TSconfig PID
- $incomingFieldArray : array<string|int, mixed> = []
-
the fields being explicitly set by the outside (unlike $fieldArray)
should only be used from within DataHandler
Return values
array<string|int, mixed> —Returns the evaluated $value as key "value" in this array. Can be checked with isset($res['value']) ...
checkValue_category_processDBdata()
Returns processed data for category fields
public
checkValue_category_processDBdata(array<string|int, mixed> $valueArray, array<string|int, mixed> $tcaFieldConf, string|int $id, string $status, string $table, string $field) : array<string|int, mixed>
Parameters
- $valueArray : array<string|int, mixed>
-
Current value array
- $tcaFieldConf : array<string|int, mixed>
-
TCA field config
- $id : string|int
-
Record id, used for look-up of MM relations (local_uid)
- $status : string
-
Status string ('update' or 'new')
- $table : string
-
Table name, needs to be passed to \TYPO3\CMS\Core\Database\RelationHandler
- $field : string
-
field name, needs to be set for writing to sys_history
should only be used from within DataHandler
Return values
array<string|int, mixed> —Modified value array
checkValue_checkMax()
Checks if a fields has more items than defined via TCA in maxitems.
public
checkValue_checkMax(array<string|int, mixed> $tcaFieldConf, array<string|int, mixed> $valueArray) : array<string|int, mixed>
If there are more items than allowed, the item list is truncated to the defined number.
Parameters
- $tcaFieldConf : array<string|int, mixed>
-
Field configuration from TCA
- $valueArray : array<string|int, mixed>
-
Current value array of items
should only be used from within DataHandler
Return values
array<string|int, mixed> —The truncated value array of items
checkValue_flex_procInData()
Starts the processing the input data for flexforms. This will traverse all sheets / languages and for each it will traverse the sub-structure.
public
checkValue_flex_procInData(array<string|int, mixed> $dataPart, array<string|int, mixed> $dataPart_current, array<string|int, mixed> $dataStructure, array<string|int, mixed> $pParams[, string $callBackFunc = '' ][, array<string|int, mixed> $workspaceOptions = [] ]) : array<string|int, mixed>
See checkValue_flex_procInData_travDS() for more details. WARNING: Currently, it traverses based on the actual data array and NOT the structure. This means that values for non-valid fields, lKey/vKey/sKeys will be accepted! For traversal of data with a call back function you should rather use \TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools
Parameters
- $dataPart : array<string|int, mixed>
-
The 'data' part of the INPUT flexform data
- $dataPart_current : array<string|int, mixed>
-
The 'data' part of the CURRENT flexform data
- $dataStructure : array<string|int, mixed>
-
Data structure for the form (might be sheets or not). Only values in the data array which has a configuration in the data structure will be processed.
- $pParams : array<string|int, mixed>
-
A set of parameters to pass through for the calling of the evaluation functions
- $callBackFunc : string = ''
-
Optional call back function, see checkValue_flex_procInData_travDS() DEPRECATED, use \TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools instead for traversal!
- $workspaceOptions : array<string|int, mixed> = []
should only be used from within DataHandler
Tags
Return values
array<string|int, mixed> —The modified 'data' part.
checkValue_flex_procInData_travDS()
Processing of the sheet/language data array When it finds a field with a value the processing is done by ->checkValue_SW() by default but if a call back function name is given that method in this class will be called for the processing instead.
public
checkValue_flex_procInData_travDS(array<string|int, mixed> &$dataValues, array<string|int, mixed> $dataValues_current, array<string|int, mixed> $DSelements, array<string|int, mixed> $pParams, string $callBackFunc, string $structurePath[, array<string|int, mixed> $workspaceOptions = [] ]) : mixed
Parameters
- $dataValues : array<string|int, mixed>
-
New values (those being processed): Multidimensional Data array for sheet/language, passed by reference!
- $dataValues_current : array<string|int, mixed>
-
Current values: Multidimensional Data array. May be empty array() if not needed (for callBackFunctions)
- $DSelements : array<string|int, mixed>
-
Data structure which fits the data array
- $pParams : array<string|int, mixed>
-
A set of parameters to pass through for the calling of the evaluation functions / call back function
- $callBackFunc : string
-
Call back function, default is checkValue_SW(). If $this->callBackObj is set to an object, the callback function in that object is called instead.
- $structurePath : string
- $workspaceOptions : array<string|int, mixed> = []
should only be used from within DataHandler
Tags
checkValue_flexArray2Xml()
Converts an array to FlexForm XML
public
checkValue_flexArray2Xml(array<string|int, mixed> $array[, bool $addPrologue = false ]) : string
Parameters
- $array : array<string|int, mixed>
-
Array with FlexForm data
- $addPrologue : bool = false
-
If set, the XML prologue is returned as well.
should only be used from within DataHandler
Return values
string —Input array converted to XML
checkValue_group_select_explodeSelectGroupValue()
Explodes the $value, which is a list of files/uids (group select)
public
checkValue_group_select_explodeSelectGroupValue(string $value) : array<string|int, mixed>
Parameters
- $value : string
-
Input string, comma separated values. For each part it will also be detected if a '|' is found and the first part will then be used if that is the case. Further the value will be rawurldecoded.
should only be used from within DataHandler
Return values
array<string|int, mixed> —The value array.
checkValue_group_select_processDBdata()
Returns data for group/db and select fields
public
checkValue_group_select_processDBdata(array<string|int, mixed> $valueArray, array<string|int, mixed> $tcaFieldConf, int $id, string $status, string $type, string $currentTable, string $currentField) : array<string|int, mixed>
Parameters
- $valueArray : array<string|int, mixed>
-
Current value array
- $tcaFieldConf : array<string|int, mixed>
-
TCA field config
- $id : int
-
Record id, used for look-up of MM relations (local_uid)
- $status : string
-
Status string ('update' or 'new')
- $type : string
-
The type, either 'select', 'group' or 'inline'
- $currentTable : string
-
Table name, needs to be passed to \TYPO3\CMS\Core\Database\RelationHandler
- $currentField : string
-
field name, needs to be set for writing to sys_history
should only be used from within DataHandler
Return values
array<string|int, mixed> —Modified value array
checkValue_inline()
Evaluates 'inline' type values.
public
checkValue_inline(array<string|int, mixed> $res, string $value, array<string|int, mixed> $tcaFieldConf, array<string|int, mixed> $PP, string $field[, array<string|int, mixed>|null $additionalData = null ]) : mixed
(partly copied from the select_group function on this issue)
Parameters
- $res : array<string|int, mixed>
-
The result array. The processed value (if any!) is set in the 'value' key.
- $value : string
-
The value to set.
- $tcaFieldConf : array<string|int, mixed>
-
Field configuration from TCA
- $PP : array<string|int, mixed>
-
Additional parameters in a numeric array: $table,$id,$curValue,$status,$realPid,$recFID
- $field : string
-
Field name
- $additionalData : array<string|int, mixed>|null = null
-
Additional data to be forwarded to sub-processors
should only be used from within DataHandler
checkValue_input_Eval()
Evaluation of 'input'-type values based on 'eval' list
public
checkValue_input_Eval(string $value, array<string|int, mixed> $evalArray, string $is_in[, string $table = '' ][, string|int $id = '' ]) : array<string|int, mixed>
Parameters
- $value : string
-
Value to evaluate
- $evalArray : array<string|int, mixed>
-
Array of evaluations to traverse.
- $is_in : string
-
Is-in string for 'is_in' evaluation
- $table : string = ''
-
Table name the eval is evaluated on
- $id : string|int = ''
-
Record ID the eval is evaluated on
should only be used from within DataHandler
Return values
array<string|int, mixed> —Modified $value in key 'value' or empty array
checkValue_SW()
Branches out evaluation of a field value based on its type as configured in $GLOBALS['TCA'] Can be called for FlexForm pseudo fields as well, BUT must not have $field set if so.
public
checkValue_SW(array<string|int, mixed> $res, string $value, array<string|int, mixed> $tcaFieldConf, string $table, int $id, mixed $curValue, string $status, int $realPid, string $recFID, string $field, int $tscPID[, array<string|int, mixed>|null $additionalData = null ]) : array<string|int, mixed>
And hey, there's a good thing about the method arguments: 13 is prime :-P
Parameters
- $res : array<string|int, mixed>
-
The result array. The processed value (if any!) is set in the "value" key.
- $value : string
-
The value to set.
- $tcaFieldConf : array<string|int, mixed>
-
Field configuration from $GLOBALS['TCA']
- $table : string
-
Table name
- $id : int
-
UID of record
- $curValue : mixed
-
Current value of the field
- $status : string
-
'update' or 'new' flag
- $realPid : int
-
The real PID value of the record. For updates, this is just the pid of the record. For new records this is the PID of the page where it is inserted.
- $recFID : string
-
Field identifier [table:uid:field] for flexforms
- $field : string
-
Field name. Must NOT be set if the call is for a flexform field (since flexforms are not allowed within flexforms).
- $tscPID : int
-
TSconfig PID
- $additionalData : array<string|int, mixed>|null = null
-
Additional data to be forwarded to sub-processors
should only be used from within DataHandler
Return values
array<string|int, mixed> —Returns the evaluated $value as key "value" in this array.
checkValue_text_Eval()
public
checkValue_text_Eval(string $value, array<string|int, mixed> $evalArray, string $is_in) : array<string|int, mixed>
Parameters
- $value : string
-
The field value to be evaluated
- $evalArray : array<string|int, mixed>
-
Array of evaluations to traverse.
- $is_in : string
-
The "is_in" value of the field configuration from TCA
should only be used from within DataHandler
Return values
array<string|int, mixed>checkValueForInline()
Evaluates 'inline' type values.
public
checkValueForInline(array<string|int, mixed> $res, string $value, array<string|int, mixed> $tcaFieldConf, string $table, int $id, string $status, string $field[, array<string|int, mixed>|null $additionalData = null ]) : array<string|int, mixed>|false
(partly copied from the select_group function on this issue)
Parameters
- $res : array<string|int, mixed>
-
The result array. The processed value (if any!) is set in the 'value' key.
- $value : string
-
The value to set.
- $tcaFieldConf : array<string|int, mixed>
-
Field configuration from TCA
- $table : string
-
Table name
- $id : int
-
UID of record
- $status : string
-
'update' or 'new' flag
- $field : string
-
Field name
- $additionalData : array<string|int, mixed>|null = null
-
Additional data to be forwarded to sub-processors
should only be used from within DataHandler
Return values
array<string|int, mixed>|false —Modified $res array
clear_cacheCmd()
Clears the cache based on the command $cacheCmd.
public
clear_cacheCmd(string $cacheCmd) : mixed
$cacheCmd='pages' Clears cache for all pages and page-based caches inside the cache manager. Requires admin-flag to be set for BE_USER.
$cacheCmd='all' Clears all cache_tables. This is necessary if templates are updated. Requires admin-flag to be set for BE_USER.
The following cache_* are intentionally not cleared by 'all'
- imagesizes: Clearing this table would cause a lot of unneeded Imagemagick calls because the size information has to be fetched again after clearing.
- all caches inside the cache manager that are inside the group "system"
- they are only needed to build up the core system and templates. If the group of system caches needs to be deleted explicitly, use flushCachesInGroup('system') of CacheManager directly.
$cacheCmd=[integer] Clears cache for the page pointed to by $cacheCmd (an integer).
$cacheCmd='cacheTag:[string]' Flush page and pagesection cache by given tag
$cacheCmd='cacheId:[string]' Removes cache identifier from page and page section cache
Can call a list of post processing functions as defined in $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc'] (numeric array with values being the function references, called by GeneralUtility::callUserFunction()).
Parameters
- $cacheCmd : string
-
The cache command, see above description
clearPrefixFromValue()
Removes the prependAtCopy prefix on values
public
clearPrefixFromValue(string $table, string $value) : string
Parameters
- $table : string
-
Table name
- $value : string
-
The value to fix
should only be used from within DataHandler
Return values
string —Clean name
compareFieldArrayWithCurrentAndUnset()
Compares the incoming field array with the current record and unsets all fields which are the same.
public
compareFieldArrayWithCurrentAndUnset(string $table, int $id, array<string|int, mixed> $fieldArray) : array<string|int, mixed>
Used for existing records being updated
Parameters
- $table : string
-
Record table name
- $id : int
-
Record uid
- $fieldArray : array<string|int, mixed>
-
Array of field=>value pairs intended to be inserted into the database. All keys with values matching exactly the current value will be unset!
should only be used from within DataHandler
Return values
array<string|int, mixed> —Returns $fieldArray. If the returned array is empty, then the record should not be updated!
compileAdminTables()
List of all tables (those administrators has access to = array_keys of $GLOBALS['TCA'])
public
compileAdminTables() : array<string|int, mixed>
should only be used from within DataHandler
Return values
array<string|int, mixed> —Array of all TCA table names
copyL10nOverlayRecords()
Find l10n-overlay records and perform the requested copy action for these records.
public
copyL10nOverlayRecords(string $table, int $uid, int $destPid[, bool $first = false ][, array<string|int, mixed> $overrideValues = [] ][, string $excludeFields = '' ]) : mixed
Parameters
- $table : string
-
Record Table
- $uid : int
-
UID of the record in the default language
- $destPid : int
-
Position to copy to
- $first : bool = false
- $overrideValues : array<string|int, mixed> = []
- $excludeFields : string = ''
should only be used from within DataHandler
copyPages()
Copying pages Main function for copying pages.
public
copyPages(int $uid, int $destPid) : mixed
Parameters
- $uid : int
-
Page UID to copy
- $destPid : int
-
Destination PID: >=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
should only be used from within DataHandler
copyRecord()
Copying a single record
public
copyRecord(string $table, int $uid, int $destPid[, bool $first = false ][, array<string|int, mixed> $overrideValues = [] ][, string $excludeFields = '' ][, int $language = 0 ][, bool $ignoreLocalization = false ]) : int|null
Parameters
- $table : string
-
Element table
- $uid : int
-
Element UID
- $destPid : int
-
=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
- $first : bool = false
-
Is a flag set, if the record copied is NOT a 'slave' to another record copied. That is, if this record was asked to be copied in the cmd-array
- $overrideValues : array<string|int, mixed> = []
-
Associative array with field/value pairs to override directly. Notice; Fields must exist in the table record and NOT be among excluded fields!
- $excludeFields : string = ''
-
Commalist of fields to exclude from the copy process (might get default values)
- $language : int = 0
-
Language ID (from sys_language table)
- $ignoreLocalization : bool = false
-
If TRUE, any localization routine is skipped
should only be used from within DataHandler
Return values
int|null —ID of new record, if any
copyRecord_flexFormCallBack()
Callback function for traversing the FlexForm structure in relation to creating copied files of file relations inside of flex form structures.
public
copyRecord_flexFormCallBack(array<string|int, mixed> $pParams, array<string|int, mixed> $dsConf, string $dataValue, string $_1, string $_2, array<string|int, mixed> $workspaceOptions) : array<string|int, mixed>
Parameters
- $pParams : array<string|int, mixed>
-
Array of parameters in num-indexes: table, uid, field
- $dsConf : array<string|int, mixed>
-
TCA field configuration (from Data Structure XML)
- $dataValue : string
-
The value of the flexForm field
- $_1 : string
-
Not used.
- $_2 : string
-
Not used.
- $workspaceOptions : array<string|int, mixed>
should only be used from within DataHandler
Tags
Return values
array<string|int, mixed> —Result array with key "value" containing the value of the processing.
copyRecord_procBasedOnFieldType()
Processing/Preparing content for copyRecord() function
public
copyRecord_procBasedOnFieldType(string $table, int $uid, string $field, string|null $value, array<string|int, mixed> $row, array<string|int, mixed> $conf, int $realDestPid[, int $language = 0 ][, array<string|int, mixed> $workspaceOptions = [] ]) : array<string|int, mixed>|string|null
Parameters
- $table : string
-
Table name
- $uid : int
-
Record uid
- $field : string
-
Field name being processed
- $value : string|null
-
Input value to be processed.
- $row : array<string|int, mixed>
-
Record array
- $conf : array<string|int, mixed>
-
TCA field configuration
- $realDestPid : int
-
Real page id (pid) the record is copied to
- $language : int = 0
-
Language ID (from sys_language table) used in the duplicated record
- $workspaceOptions : array<string|int, mixed> = []
-
Options to be forwarded if actions happen on a workspace currently
Tags
Return values
array<string|int, mixed>|string|nullcopyRecord_raw()
Copying records, but makes a "raw" copy of a record.
public
copyRecord_raw(string $table, int $uid, int $pid[, array<string|int, mixed> $overrideArray = [] ][, array<string|int, mixed> $workspaceOptions = [] ]) : int|null
Basically the only thing observed is field processing like the copying of files and correction of ids. All other fields are 1-1 copied. Technically the copy is made with THIS instance of the DataHandler class contrary to copyRecord() which creates a new instance and uses the processData() function. The copy is created by insertNewCopyVersion() which bypasses most of the regular input checking associated with processData() - maybe copyRecord() should even do this as well!? This function is used to create new versions of a record. NOTICE: DOES NOT CHECK PERMISSIONS to create! And since page permissions are just passed through and not changed to the user who executes the copy we cannot enforce permissions without getting an incomplete copy - unless we change permissions of course.
Parameters
- $table : string
-
Element table
- $uid : int
-
Element UID
- $pid : int
-
Element PID (real PID, not checked)
- $overrideArray : array<string|int, mixed> = []
-
Override array - must NOT contain any fields not in the table!
- $workspaceOptions : array<string|int, mixed> = []
-
Options to be forwarded if actions happen on a workspace currently
should only be used from within DataHandler
Return values
int|null —Returns the new ID of the record (if applicable)
copySpecificPage()
Copying a single page ($uid) to $destPid and all tables in the array copyTablesArray.
public
copySpecificPage(int $uid, int $destPid, array<string|int, mixed> $copyTablesArray[, bool $first = false ]) : int|null
Parameters
- $uid : int
-
Page uid
- $destPid : int
-
Destination PID: >=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
- $copyTablesArray : array<string|int, mixed>
-
Table on pages to copy along with the page.
- $first : bool = false
-
Is a flag set, if the record copied is NOT a 'slave' to another record copied. That is, if this record was asked to be copied in the cmd-array
should only be used from within DataHandler
Return values
int|null —The id of the new page, if applicable.
dbAnalysisStoreExec()
Executing dbAnalysisStore This will save MM relations for new records but is executed after records are created because we need to know the ID of them
public
dbAnalysisStoreExec() : mixed
should only be used from within DataHandler
deleteAction()
Delete a single record
public
deleteAction(string $table, int $id) : mixed
Parameters
- $table : string
-
Table name
- $id : int
-
Record UID
should only be used from within DataHandler
deleteClause()
Returns delete-clause for the $table
public
deleteClause(string $table) : string
Parameters
- $table : string
-
Table name
should only be used from within DataHandler
Return values
string —Delete clause
deleteEl()
Delete element from any table
public
deleteEl(string $table, int $uid[, bool $noRecordCheck = false ][, bool $forceHardDelete = false ][, bool $deleteRecordsOnPage = true ]) : mixed
Parameters
- $table : string
-
Table name
- $uid : int
-
Record UID
- $noRecordCheck : bool = false
-
Flag: If $noRecordCheck is set, then the function does not check permission to delete record
- $forceHardDelete : bool = false
-
If TRUE, the "deleted" flag is ignored if applicable for record and the record is deleted COMPLETELY!
- $deleteRecordsOnPage : bool = true
-
If false and if deleting pages, records on the page will not be deleted (edge case while swapping workspaces)
should only be used from within DataHandler
deleteL10nOverlayRecords()
Find l10n-overlay records and perform the requested delete action for these records.
public
deleteL10nOverlayRecords(string $table, int $uid) : mixed
Parameters
- $table : string
-
Record Table
- $uid : int
-
Record UID
should only be used from within DataHandler
deletePages()
Used to delete page because it will check for branch below pages and disallowed tables on the page as well.
public
deletePages(int $uid[, bool $force = false ][, bool $forceHardDelete = false ][, bool $deleteRecordsOnPage = true ]) : mixed
Parameters
- $uid : int
-
Page id
- $force : bool = false
-
If TRUE, pages are not checked for permission.
- $forceHardDelete : bool = false
-
If TRUE, the "deleted" flag is ignored if applicable for record and the record is deleted COMPLETELY!
- $deleteRecordsOnPage : bool = true
-
If false, records on the page will not be deleted (edge case while swapping workspaces)
should only be used from within DataHandler
deleteRecord()
Deleting a record This function may not be used to delete pages-records unless the underlying records are already deleted Deletes a record regardless of versioning state (live or offline, doesn't matter, the uid decides) If both $noRecordCheck and $forceHardDelete are set it could even delete a "deleted"-flagged record!
public
deleteRecord(string $table, int $uid[, bool $noRecordCheck = false ][, bool $forceHardDelete = false ]) : mixed
Parameters
- $table : string
-
Table name
- $uid : int
-
Record UID
- $noRecordCheck : bool = false
-
Flag: If $noRecordCheck is set, then the function does not check permission to delete record
- $forceHardDelete : bool = false
-
If TRUE, the "deleted" flag is ignored if applicable for record and the record is deleted COMPLETELY!
should only be used from within DataHandler
deleteRecord_procBasedOnFieldType()
Process fields of a record to be deleted and search for special handling, like inline type, MM records, etc.
public
deleteRecord_procBasedOnFieldType(string $table, int $uid, string $value, array<string|int, mixed> $conf) : void
Parameters
- $table : string
-
Record Table
- $uid : int
-
Record UID
- $value : string
-
Record field value
- $conf : array<string|int, mixed>
-
TCA configuration of current field
should only be used from within DataHandler
Tags
deleteRecord_procFields()
Before a record is deleted, check if it has references such as inline type or MM references.
public
deleteRecord_procFields(string $table, int $uid) : mixed
If so, set these child records also to be deleted.
Parameters
- $table : string
-
Record Table
- $uid : int
-
Record UID
should only be used from within DataHandler
Tags
deleteSpecificPage()
Delete a page (or set deleted field to 1) and all records on it.
public
deleteSpecificPage(int $uid[, bool $forceHardDelete = false ][, bool $deleteRecordsOnPage = true ]) : mixed
Parameters
- $uid : int
-
Page id
- $forceHardDelete : bool = false
-
If TRUE, the "deleted" flag is ignored if applicable for record and the record is deleted COMPLETELY!
- $deleteRecordsOnPage : bool = true
-
If false, records on the page will not be deleted (edge case while swapping workspaces)
Tags
destNotInsideSelf()
Checks if page $id is a uid in the rootline of page id $destinationId Used when moving a page
public
destNotInsideSelf(int $destinationId, int $id) : bool
Parameters
- $destinationId : int
-
Destination Page ID to test
- $id : int
-
Page ID to test for presence inside Destination
should only be used from within DataHandler
Return values
bool —Returns FALSE if ID is inside destination (including equal to)
disableDeleteClause()
Disables the delete clause for fetching records.
public
disableDeleteClause() : mixed
In general only undeleted records will be used. If the delete clause is disabled, also deleted records are taken into account.
discard()
Discard a versioned record from this workspace. This deletes records from the database - no soft delete.
public
discard(string $table, int|null $uid[, array<string|int, mixed>|null $record = null ]) : void
This main entry method is called recursive for sub pages, localizations, relations and records on a page. The method checks user access and gathers facts about this record to hand the deletion over to detail methods.
The incoming $uid or $row can be anything: The workspace of current user is respected and only records of current user workspace are discarded. If giving a live record uid, the versioned overly will be fetched.
Parameters
- $table : string
-
Database table name
- $uid : int|null
-
Uid of live or versioned record to be discarded, or null if $record is given
- $record : array<string|int, mixed>|null = null
-
Record row that should be discarded. Used instead of $uid within recursion.
should only be used from within DataHandler
doesBranchExist()
Checks if a whole branch of pages exists
public
doesBranchExist(string $inList, int $pid, int $perms, bool $recurse) : string|int
Tests the branch under $pid like doesRecordExist(), but it doesn't test the page with $pid as uid - use doesRecordExist() for this purpose. If $recurse is set, the function will follow subpages. This MUST be set, if we need the id-list for deleting pages or else we get an incomplete list
Parameters
- $inList : string
-
List of page uids, this is added to and returned in the end
- $pid : int
-
Page ID to select subpages from.
- $perms : int
-
Perms integer to check each page record for.
- $recurse : bool
-
Recursion flag: If set, it will go out through the branch.
should only be used from within DataHandler
Return values
string|int —List of page IDs in branch, if there are subpages, empty string if there are none or -1 if no permission
doesPageHaveUnallowedTables()
Checks if there are records on a page from tables that are not allowed
public
doesPageHaveUnallowedTables(int|string $page_uid, int $doktype) : bool|array<string|int, mixed>
Parameters
- $page_uid : int|string
-
Page ID
- $doktype : int
-
Page doktype
should only be used from within DataHandler
Return values
bool|array<string|int, mixed> —Returns a list of the tables that are 'present' on the page but not allowed with the page_uid/doktype
doesRecordExist()
Checks if record can be selected based on given permission criteria
public
doesRecordExist(string $table, int $id, int $perms) : bool
Parameters
- $table : string
-
Record table name
- $id : int
-
Record UID
- $perms : int
-
Permission restrictions to observe: integer that will be bitwise AND'ed.
should only be used from within DataHandler
Tags
Return values
bool —Returns TRUE if the record given by $table, $id and $perms can be selected
eventPid()
public
eventPid(string $table, int $uid, int $pid) : int
Parameters
- $table : string
- $uid : int
- $pid : int
should only be used from within DataHandler
Return values
intfillInFieldArray()
Filling in the field array $this->excludedTablesAndFields is used to filter fields if needed.
public
fillInFieldArray(string $table, int|string $id, array<string|int, mixed> $fieldArray, array<string|int, mixed> $incomingFieldArray, int $realPid, string $status, int $tscPID) : array<string|int, mixed>
Parameters
- $table : string
-
Table name
- $id : int|string
-
Record ID
- $fieldArray : array<string|int, mixed>
-
Default values, Preset $fieldArray with 'pid' maybe (pid and uid will be not be overridden anyway)
- $incomingFieldArray : array<string|int, mixed>
-
Is which fields/values you want to set. There are processed and put into $fieldArray if OK
- $realPid : int
-
The real PID value of the record. For updates, this is just the pid of the record. For new records this is the PID of the page where it is inserted.
- $status : string
-
Is 'new' or 'update'
- $tscPID : int
-
TSconfig PID
should only be used from within DataHandler
Return values
array<string|int, mixed> —Field Array
fixCopyAfterDuplFields()
When er record is copied you can specify fields from the previous record which should be copied into the new one This function is also called with new elements. But then $update must be set to zero and $newData containing the data array. In that case data in the incoming array is NOT overridden. (250202)
public
fixCopyAfterDuplFields(string $table, int $uid, int $prevUid, bool $update[, array<string|int, mixed> $newData = [] ]) : array<string|int, mixed>
Parameters
- $table : string
-
Table name
- $uid : int
-
Record UID
- $prevUid : int
-
UID of previous record
- $update : bool
-
If set, updates the record
- $newData : array<string|int, mixed> = []
-
Input array. If fields are already specified AND $update is not set, values are not set in output array.
should only be used from within DataHandler
Return values
array<string|int, mixed> —Output array (For when the copying operation needs to get the information instead of updating the info)
fixUniqueInPid()
Checks if any uniqueInPid eval input fields are in the record and if so, they are re-written to be correct.
public
fixUniqueInPid(string $table, int $uid) : mixed
Parameters
- $table : string
-
Table name
- $uid : int
-
Record UID
should only be used from within DataHandler
getAutoVersionId()
Gets the automatically versionized id of a record.
public
getAutoVersionId(string $table, int $id) : int|null
Parameters
- $table : string
-
Name of the table
- $id : int
-
Uid of the record
should only be used from within TYPO3 Core
Return values
int|nullgetCopyHeader()
Get modified header for a copied record
public
getCopyHeader(string $table, int $pid, string $field, string $value, int $count[, string $prevTitle = '' ]) : string
Parameters
- $table : string
-
Table name
- $pid : int
-
PID value in which other records to test might be
- $field : string
-
Field name to get header value for.
- $value : string
-
Current field value
- $count : int
-
Counter (number of recursions)
- $prevTitle : string = ''
-
Previous title we checked for (in previous recursion)
should only be used from within DataHandler
Return values
string —The field value, possibly appended with a "copy label
getCorrelationId()
public
getCorrelationId() : CorrelationId|null
Return values
CorrelationId|nullgetExcludeListArray()
Generate an array of fields to be excluded from editing for the user. Based on "exclude"-field in TCA and a look up in non_exclude_fields Will also generate this list for admin-users so they must be check for before calling the function
public
getExcludeListArray() : array<string|int, mixed>
should only be used from within DataHandler
Return values
array<string|int, mixed> —Array of [table]-[field] pairs to exclude from editing.
getHistoryRecords()
public
getHistoryRecords() : array<string|int, mixed>
should only be used from within TYPO3 Core
Return values
array<string|int, mixed>getInlineFieldType()
Returns the subtype as a string of an inline field.
public
getInlineFieldType(array<string|int, mixed> $conf) : string|bool
If it's not an inline field at all, it returns FALSE.
Parameters
- $conf : array<string|int, mixed>
-
Config array for TCA/columns field
should only be used from within DataHandler
Return values
string|bool —string Inline subtype (field|mm|list), boolean: FALSE
getPID()
Returns the pid of a record from $table with $uid
public
getPID(string $table, int $uid) : int|false
Parameters
- $table : string
-
Table name
- $uid : int
-
Record uid
should only be used from within DataHandler
Return values
int|false —PID value (unless the record did not exist in which case FALSE is returned)
getRecordProperties()
Returns an array with record properties, like header and pid No check for deleted or access is done! For versionized records, pid is resolved to its live versions pid.
public
getRecordProperties(string $table, int $id[, bool $noWSOL = false ]) : array<string|int, mixed>
Used for logging
Parameters
- $table : string
-
Table name
- $id : int
-
Uid of record
- $noWSOL : bool = false
-
If set, no workspace overlay is performed
should only be used from within DataHandler
Return values
array<string|int, mixed> —Properties of record
getRecordPropertiesFromRow()
Returns an array with record properties, like header and pid, based on the row
public
getRecordPropertiesFromRow(string $table, array<string|int, mixed> $row) : array<string|int, mixed>|null
Parameters
- $table : string
-
Table name
- $row : array<string|int, mixed>
-
Input row
should only be used from within DataHandler
Return values
array<string|int, mixed>|null —Output array
getRecordsWithSameValue()
gets all records that have the same value in a field excluding the given uid
public
getRecordsWithSameValue(string $tableName, int $uid, string $fieldName, string $value[, int $pageId = 0 ]) : array<string|int, mixed>
Parameters
- $tableName : string
-
Table name
- $uid : int
-
UID to filter out in the lookup (the record itself...)
- $fieldName : string
-
Field name for which $value must be unique
- $value : string
-
Value string.
- $pageId : int = 0
-
If set, the value will be unique for this PID
should only be used from within DataHandler
Return values
array<string|int, mixed>getSortNumber()
Returning sorting number for tables with a "sortby" column Using when new records are created and existing records are moved around.
public
getSortNumber(string $table, int $uid, int $pid) : int|array<string|int, mixed>|bool|null
The strategy is:
- if no record exists: set interval as sorting number
- if inserted before an element: put in the middle of the existing elements
- if inserted behind the last element: add interval to last sorting number
- if collision: move all subsequent records by 2 * interval, insert new record with collision + interval
How to calculate the maximum possible inserts for the worst case of adding all records to the top, such that the sorting number stays within INT_MAX
i = interval (currently 256) c = number of inserts until collision s = max sorting number to reach (INT_MAX - 32bit) n = number of records (~83 million)
c = 2 * g g = log2(i) / 2 + 1 n = g * s / i - g + 1
The algorithm can be tuned by adjusting the interval value. Higher value means less collisions, but also less inserts are possible to stay within INT_MAX.
Parameters
- $table : string
-
Table name
- $uid : int
-
Uid of record to find sorting number for. May be zero in case of new.
- $pid : int
-
Positioning PID, either >=0 (pointing to page in which case we find sorting number for first record in page) or <0 (pointing to record in which case to find next sorting number after this record)
should only be used from within DataHandler
Return values
int|array<string|int, mixed>|bool|null —Returns integer if PID is >=0, otherwise an array with PID and sorting number. Possibly FALSE in case of error.
getTableEntries()
Extract entries from TSconfig for a specific table. This will merge specific and default configuration together.
public
getTableEntries(string $table, array<string|int, mixed> $TSconfig) : array<string|int, mixed>
Parameters
- $table : string
-
Table name
- $TSconfig : array<string|int, mixed>
-
TSconfig for page
should only be used from within DataHandler
Return values
array<string|int, mixed> —TSconfig merged
getUnique()
Gets a unique value for $table/$id/$field based on $value
public
getUnique(string $table, string $field, string $value, int $id[, int $newPid = 0 ]) : string
Parameters
- $table : string
-
Table name
- $field : string
-
Field name for which $value must be unique
- $value : string
-
Value string.
- $id : int
-
UID to filter out in the lookup (the record itself...)
- $newPid : int = 0
-
If set, the value will be unique for this PID
should only be used from within DataHandler
Tags
Return values
string —Modified value (if not-unique). Will be the value appended with a number (until 100, then the function just breaks).
getVersionizedIncomingFieldArray()
If a parent record was versionized on a workspace in $this->process_datamap, it might be possible, that child records (e.g. on using IRRE) were affected.
public
getVersionizedIncomingFieldArray(string $table, int $id, array<string|int, mixed> &$incomingFieldArray, array<string|int, mixed> &$registerDBList) : void
This function finds these relations and updates their uids in the $incomingFieldArray. The $incomingFieldArray is updated by reference!
Parameters
- $table : string
-
Table name of the parent record
- $id : int
-
Uid of the parent record
- $incomingFieldArray : array<string|int, mixed>
-
Reference to the incomingFieldArray of process_datamap
- $registerDBList : array<string|int, mixed>
-
Reference to the $registerDBList array that was created/updated by versionizing calls to DataHandler in process_datamap.
should only be used from within DataHandler
hasDeletedRecord()
Determines whether a particular record has been deleted using DataHandler::deleteRecord() in this instance.
public
hasDeletedRecord(string $tableName, int $uid) : bool
Parameters
- $tableName : string
- $uid : int
should only be used from within TYPO3 Core
Return values
boolhook_processDatamap_afterDatabaseOperations()
Hook: processDatamap_afterDatabaseOperations (calls $hookObj->processDatamap_afterDatabaseOperations($status, $table, $id, $fieldArray, $this);)
public
hook_processDatamap_afterDatabaseOperations(array<string|int, mixed> &$hookObjectsArr, string &$status, string &$table, string &$id, array<string|int, mixed> &$fieldArray) : mixed
Note: When using the hook after INSERT operations, you will only get the temporary NEW... id passed to your hook as $id, but you can easily translate it to the real uid of the inserted record using the $this->substNEWwithIDs array.
Parameters
- $hookObjectsArr : array<string|int, mixed>
-
(reference) Array with hook objects
- $status : string
-
(reference) Status of the current operation, 'new' or 'update
- $table : string
-
(reference) The table currently processing data for
- $id : string
-
(reference) The record uid currently processing data for, [integer] or [string] (like 'NEW...')
- $fieldArray : array<string|int, mixed>
-
(reference) The field array of a record
should only be used from within DataHandler
insertDB()
Insert into database Does not check permissions but expects them to be verified on beforehand
public
insertDB(string $table, string $id, array<string|int, mixed> $fieldArray[, bool $newVersion = false ][, int $suggestedUid = 0 ][, bool $dontSetNewIdIndex = false ]) : int|null
Parameters
- $table : string
-
Record table name
- $id : string
-
"NEW...." uid string
- $fieldArray : array<string|int, mixed>
-
Array of field=>value pairs to insert. FIELDS MUST MATCH the database FIELDS. No check is done. "pid" must point to the destination of the record!
- $newVersion : bool = false
-
Set to TRUE if new version is created.
- $suggestedUid : int = 0
-
Suggested UID value for the inserted record. See the array $this->suggestedInsertUids; Admin-only feature
- $dontSetNewIdIndex : bool = false
-
If TRUE, the ->substNEWwithIDs array is not updated. Only useful in very rare circumstances!
should only be used from within DataHandler
Return values
int|null —Returns ID on success.
insertNewCopyVersion()
Inserts a record in the database, passing TCA configuration values through checkValue() but otherwise does NOTHING and checks nothing regarding permissions.
public
insertNewCopyVersion(string $table, array<string|int, mixed> $fieldArray, int $realPid) : int|null
Passes the "version" parameter to insertDB() so the copy will look like a new version in the log - should probably be changed or modified a bit for more broad usage...
Parameters
- $table : string
-
Table name
- $fieldArray : array<string|int, mixed>
-
Field array to insert as a record
- $realPid : int
-
The value of PID field.
should only be used from within DataHandler
Return values
int|null —Returns the new ID of the record (if applicable)
insertUpdateDB_preprocessBasedOnFieldType()
Preprocesses field array based on field type. Some fields must be adjusted before going to database. This is done on the copy of the field array because original values are used in remap action later.
public
insertUpdateDB_preprocessBasedOnFieldType(string $table, array<string|int, mixed> $fieldArray) : array<string|int, mixed>
Parameters
- $table : string
-
Table name
- $fieldArray : array<string|int, mixed>
-
Field array to check
should only be used from within TYPO3 Core
Return values
array<string|int, mixed> —Updated field array
int_pageTreeInfo()
Returns array, $CPtable, of pages under the $pid going down to $counter levels.
public
int_pageTreeInfo(array<string|int, mixed> $CPtable, int $pid, int $counter, int $rootID) : array<string|int, mixed>
Selecting ONLY pages which the user has read-access to!
Parameters
- $CPtable : array<string|int, mixed>
-
Accumulation of page uid=>pid pairs in branch of $pid
- $pid : int
-
Page ID for which to find subpages
- $counter : int
-
Number of levels to go down.
- $rootID : int
-
ID of root point for new copied branch: The idea seems to be that a copy is not made of the already new page!
should only be used from within DataHandler
Return values
array<string|int, mixed> —Return array.
isInWebMount()
Checks if the input page ID is in the BE_USER webmounts
public
isInWebMount(int $pid) : bool
Parameters
- $pid : int
-
Page ID to check
should only be used from within DataHandler
Return values
bool —TRUE if OK. Cached results.
isOuterMostInstance()
Determines whether the this object is the outer most instance of itself Since DataHandler can create nested objects of itself, this method helps to determine the first (= outer most) one.
public
isOuterMostInstance() : bool
Return values
boolisRecordCopied()
Determine if a record was copied or if a record is the result of a copy action.
public
isRecordCopied(string $table, int $uid) : bool
Parameters
- $table : string
-
The tablename of the record
- $uid : int
-
The uid of the record
should only be used from within DataHandler
Return values
bool —Returns TRUE if the record is copied or is the result of a copy action
isRecordInWebMount()
Checking if a record with uid $id from $table is in the BE_USERS webmounts which is required for editing etc.
public
isRecordInWebMount(string $table, int $id) : bool
Parameters
- $table : string
-
Table name
- $id : int
-
UID of record
should only be used from within DataHandler
Return values
bool —Returns TRUE if OK. Cached results.
isReferenceField()
Returns TRUE if the TCA/columns field type is a DB reference field
public
isReferenceField(array<string|int, mixed> $conf) : bool
Parameters
- $conf : array<string|int, mixed>
-
Config array for TCA/columns field
should only be used from within DataHandler
Return values
bool —TRUE if DB reference field (group/db or select with foreign-table)
isTableAllowedForThisPage()
Checks if a table is allowed on a certain page id according to allowed tables set for the page "doktype" and its [ctrl][rootLevel]-settings if any.
public
isTableAllowedForThisPage(int $page_uid, string $checkTable) : bool
Parameters
- $page_uid : int
-
Page id for which to check, including 0 (zero) if checking for page tree root.
- $checkTable : string
-
Table name to check
should only be used from within DataHandler
Return values
bool —TRUE if OK
localize()
Localizes a record to another system language
public
localize(string $table, int $uid, int $language) : int|bool
Parameters
- $table : string
-
Table name
- $uid : int
-
Record uid (to be localized)
- $language : int
-
Language ID (from sys_language table)
should only be used from within DataHandler
Return values
int|bool —The uid (int) of the new translated record or FALSE (bool) if something went wrong
log()
Logging actions from DataHandler
public
log(string $table, int $recuid, int $action, int|string $recpid, int $error, string $details[, int $details_nr = -1 ][, array<string|int, mixed> $data = [] ][, int $event_pid = -1 ][, string $NEWid = '' ]) : int
Parameters
- $table : string
-
Table name the log entry is concerned with. Blank if NA
- $recuid : int
-
Record UID. Zero if NA
- $action : int
-
Action number: 0=No category, 1=new record, 2=update record, 3= delete record, 4= move record, 5= Check/evaluate
- $recpid : int|string
-
Normally 0 (zero). If set, it indicates that this log-entry is used to notify the backend of a record which is moved to another location
- $error : int
-
The severity: 0 = message, 1 = error, 2 = System Error, 3 = security notice (admin), 4 warning
- $details : string
-
Default error message in english
- $details_nr : int = -1
-
This number is unique for every combination of $type and $action. This is the error-message number, which can later be used to translate error messages. 0 if not categorized, -1 if temporary
- $data : array<string|int, mixed> = []
-
Array with special information that may go into $details by '%s' marks / sprintf() when the log is shown
- $event_pid : int = -1
-
The page_uid (pid) where the event occurred. Used to select log-content for specific pages.
- $NEWid : string = ''
-
NEW id for new records
should only be used from within TYPO3 Core
Tags
Return values
int —Log entry UID (0 if no log entry was written or logging is disabled)
moveL10nOverlayRecords()
Find l10n-overlay records and perform the requested move action for these records.
public
moveL10nOverlayRecords(string $table, int $uid, int $destPid, int $originalRecordDestinationPid) : mixed
Parameters
- $table : string
-
Record Table
- $uid : int
-
Record UID
- $destPid : int
-
Position to move to
- $originalRecordDestinationPid : int
-
Position to move the original record to
should only be used from within DataHandler
moveRecord()
Moving single records
public
moveRecord(string $table, int $uid, int $destPid) : mixed
Parameters
- $table : string
-
Table name to move
- $uid : int
-
Record uid to move
- $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
should only be used from within DataHandler
moveRecord_procBasedOnFieldType()
Move child records depending on the field type of the parent record.
public
moveRecord_procBasedOnFieldType(string $table, int $uid, int $destPid, string $value, array<string|int, mixed> $conf) : mixed
Parameters
- $table : string
-
Record Table
- $uid : int
-
Record UID
- $destPid : int
-
Position to move to
- $value : string
-
Record field value
- $conf : array<string|int, mixed>
-
TCA configuration of current field
should only be used from within DataHandler
moveRecord_procFields()
Walk through all fields of the moved record and look for children of e.g. the inline type.
public
moveRecord_procFields(string $table, int $uid, int $destPid) : mixed
If child records are found, they are also move to the new $destPid.
Parameters
- $table : string
-
Record Table
- $uid : int
-
Record UID
- $destPid : int
-
Position to move to
should only be used from within DataHandler
moveRecord_raw()
Moves a record without checking security of any sort.
public
moveRecord_raw(string $table, int $uid, int $destPid) : mixed
USE ONLY INTERNALLY
Parameters
- $table : string
-
Table name to move
- $uid : int
-
Record uid to move
- $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
should only be used from within DataHandler
Tags
newFieldArray()
Returns a fieldArray with default values. Values will be picked up from the TCA array looking at the config key "default" for each column. If values are set in ->defaultValues they will overrule though.
public
newFieldArray(string $table) : array<string|int, mixed>
Used for new records and during copy operations for defaults
Parameters
- $table : string
-
Table name for which to set default values.
should only be used from within DataHandler
Return values
array<string|int, mixed> —Array with default values.
overrideFieldArray()
Returns the $data array from $table overridden in the fields defined in ->overrideValues.
public
overrideFieldArray(string $table, array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
- $table : string
-
Table name
- $data : array<string|int, mixed>
-
Data array with fields from table. These will be overlaid with values in $this->overrideValues[$table]
should only be used from within DataHandler
Return values
array<string|int, mixed> —Data array, processed.
pageInfo()
Returns the value of the $field from page $id NOTICE; the function caches the result for faster delivery next time. You can use this function repeatedly without performance loss since it doesn't look up the same record twice!
public
pageInfo(int $id, string $field) : string
Parameters
- $id : int
-
Page uid
- $field : string
-
Field name for which to return value
should only be used from within DataHandler
Return values
string —Value of the field. Result is cached in $this->pageCache[$id][$field] and returned from there next time!
prependLabel()
Return "copy" label for a table. Although the name is "prepend" it actually APPENDs the label (after ...)
public
prependLabel(string $table) : string
Parameters
- $table : string
-
Table name
should only be used from within DataHandler
Tags
Return values
string —Label to append, containing "%s" for the number
printLogErrorMessages()
Print log error messages from the operations of this script instance
public
printLogErrorMessages() : mixed
should only be used from within TYPO3 Core
process_cmdmap()
Processing the cmd-array See "TYPO3 Core API" for a description of the options.
public
process_cmdmap() : void|bool
Return values
void|boolprocess_datamap()
Processing the data-array Call this function to process the data-array set by start()
public
process_datamap() : bool|void
Return values
bool|voidprocessRemapStack()
Processes the $this->remapStack at the end of copying, inserting, etc. actions.
public
processRemapStack() : mixed
The remapStack takes care about the correct mapping of new and old uids in case of relational data.
should only be used from within DataHandler
recordInfo()
Returns the row of a record given by $table and $id and $fieldList (list of fields, may be '*') NOTICE: No check for deleted or access!
public
recordInfo(string $table, int $id, string $fieldList) : array<string|int, mixed>|null
Parameters
- $table : string
-
Table name
- $id : int
-
UID of the record from $table
- $fieldList : string
-
Field list for the SELECT query, eg. "*" or "uid,pid,...
should only be used from within DataHandler
Return values
array<string|int, mixed>|null —Returns the selected record on success, otherwise NULL.
registerRecordIdForPageCacheClearing()
Clearing the cache based on a page being updated If the $table is 'pages' then cache is cleared for all pages on the same level (and subsequent?) Else just clear the cache for the parent page of the record.
public
registerRecordIdForPageCacheClearing(string $table, int $uid[, int $pid = null ]) : mixed
Parameters
- $table : string
-
Table name of record that was just updated.
- $uid : int
-
UID of updated / inserted record
- $pid : int = null
-
REAL PID of page of a deleted/moved record to get TSconfig in ClearCache.
This method is not meant to be called directly but only from the core itself or from hooks
registerReferenceIndexRowsForDrop()
Delete rows from sys_refindex a table / uid combination is involved in: Either on left side (tablename + recuid) OR right side (ref_table + ref_uid).
public
registerReferenceIndexRowsForDrop(string $table, int $uid, int $workspace) : void
Useful in scenarios like workspace-discard where parents or children are hard deleted: The expensive updateRefIndex() does not need to be called since we can just drop straight ahead.
Parameters
- $table : string
-
Table name, used as tablename and ref_table
- $uid : int
-
Record uid, used as recuid and ref_uid
- $workspace : int
-
Workspace the record lives in
should only be used from within DataHandler
registerReferenceIndexUpdateForReferencesToItem()
Helper method to access referenceIndexUpdater->registerUpdateForReferencesToItem() from within workspace DataHandlerHook.
public
registerReferenceIndexUpdateForReferencesToItem(string $table, int $uid, int $workspace[, int|null $targetWorkspace = null ]) : void
Parameters
- $table : string
- $uid : int
- $workspace : int
- $targetWorkspace : int|null = null
Exists only for workspace DataHandlerHook. May vanish any time.
remapListedDBRecords()
Processes the fields with references as registered during the copy process. This includes all FlexForm fields which had references.
public
remapListedDBRecords() : mixed
should only be used from within DataHandler
remapListedDBRecords_flexFormCallBack()
Callback function for traversing the FlexForm structure in relation to creating copied files of file relations inside of flex form structures.
public
remapListedDBRecords_flexFormCallBack(array<string|int, mixed> $pParams, array<string|int, mixed> $dsConf, string $dataValue) : array<string|int, mixed>
Parameters
- $pParams : array<string|int, mixed>
-
Set of parameters in numeric array: table, uid, field
- $dsConf : array<string|int, mixed>
-
TCA config for field (from Data Structure of course)
- $dataValue : string
-
Field value (from FlexForm XML)
should only be used from within DataHandler
Tags
Return values
array<string|int, mixed> —Array where the "value" key carries the value.
remapListedDBRecords_procDBRefs()
Performs remapping of old UID values to NEW uid values for a DB reference field.
public
remapListedDBRecords_procDBRefs(array<string|int, mixed> $conf, string $value, int $MM_localUid, string $table) : array<string|int, mixed>|null
Parameters
- $conf : array<string|int, mixed>
-
TCA field config
- $value : string
-
Field value
- $MM_localUid : int
-
UID of local record (for MM relations - might need to change if support for FlexForms should be done!)
- $table : string
-
Table name
should only be used from within DataHandler
Tags
Return values
array<string|int, mixed>|null —Returns array of items ready to implode for field content.
remapListedDBRecords_procInline()
Performs remapping of old UID values to NEW uid values for an inline field.
public
remapListedDBRecords_procInline(array<string|int, mixed> $conf, string $value, int $uid, string $table) : mixed
Parameters
- $conf : array<string|int, mixed>
-
TCA field config
- $value : string
-
Field value
- $uid : int
-
The uid of the ORIGINAL record
- $table : string
-
Table name
should only be used from within DataHandler
resolvePid()
Get the final pid based on $table and $pid ($destPid type... pos/neg)
public
resolvePid(string $table, int $pid) : int
Parameters
- $table : string
-
Table name
- $pid : int
-
"Destination pid" : If the value is >= 0 it's just returned directly (through (int)though) but if the value is <0 then the method looks up the record with the uid equal to abs($pid) (positive number) and returns the PID of that record! The idea is that negative numbers point to the record AFTER WHICH the position is supposed to be!
should only be used from within DataHandler
Return values
intsetControl()
public
setControl(array<string|int, mixed> $control) : mixed
Parameters
- $control : array<string|int, mixed>
setCorrelationId()
public
setCorrelationId(CorrelationId $correlationId) : void
Parameters
- $correlationId : CorrelationId
setDefaultsFromUserTS()
Initializes default values coming from User TSconfig
public
setDefaultsFromUserTS(array<string|int, mixed> $userTS) : mixed
Parameters
- $userTS : array<string|int, mixed>
-
User TSconfig array
should only be used from within DataHandler
setHistory()
Setting sys_history record, based on content previously set in $this->historyRecords[$table . ':' . $id] (by compareFieldArrayWithCurrentAndUnset())
public
setHistory(string $table, int $id) : mixed
This functionality is now moved into the RecordHistoryStore and can be used instead.
Parameters
- $table : string
-
Table name
- $id : int
-
Record ID
should only be used from within DataHandler
setMirror()
Function that can mirror input values in datamap-array to other uid numbers.
public
setMirror(array<string|int, mixed> $mirror) : mixed
Example: $mirror[table][11] = '22,33' will look for content in $this->datamap[table][11] and copy it to $this->datamap[table][22] and $this->datamap[table][33]
Parameters
- $mirror : array<string|int, mixed>
-
This array has the syntax $mirror[table_name][uid] = [list of uids to copy data-value TO!]
start()
Initializing.
public
start(array<string|int, mixed> $data, array<string|int, mixed> $cmd[, BackendUserAuthentication|null $altUserObject = null ]) : mixed
For details, see 'TYPO3 Core API' document. This function does not start the processing of data, but merely initializes the object
Parameters
- $data : array<string|int, mixed>
-
Data to be modified or inserted in the database
- $cmd : array<string|int, mixed>
-
Commands to copy, move, delete, localize, versionize records.
- $altUserObject : BackendUserAuthentication|null = null
-
An alternative userobject you can set instead of the default, which is $GLOBALS['BE_USER']
tableAdminOnly()
Checks if the $table is only editable by admin-users
public
tableAdminOnly(string $table) : bool
Parameters
- $table : string
-
Table name
should only be used from within DataHandler
Return values
bool —TRUE, if readonly
tableReadOnly()
Checks if the $table is readOnly
public
tableReadOnly(string $table) : bool
Parameters
- $table : string
-
Table name
should only be used from within DataHandler
Return values
bool —TRUE, if readonly
updateDB()
Update database record Does not check permissions but expects them to be verified on beforehand
public
updateDB(string $table, int $id, array<string|int, mixed> $fieldArray) : mixed
Parameters
- $table : string
-
Record table name
- $id : int
-
Record uid
- $fieldArray : array<string|int, mixed>
-
Array of field=>value pairs to insert. FIELDS MUST MATCH the database FIELDS. No check is done.
should only be used from within DataHandler
updateRefIndex()
Register a table/uid combination in current user workspace for reference updating.
public
updateRefIndex(string $table, int $uid[, int|null $workspace = null ]) : void
Should be called on almost any update to a record which could affect references inside the record.
Parameters
- $table : string
-
Table name
- $uid : int
-
Record UID
- $workspace : int|null = null
-
Workspace the record lives in
should only be used from within DataHandler
versionizeRecord()
Creates a new version of a record (Requires support in the table)
public
versionizeRecord(string $table, int $id, string $label[, bool $delete = false ]) : int|null
Parameters
- $table : string
-
Table name
- $id : int
-
Record uid to versionize
- $label : string
-
Version label
- $delete : bool = false
-
If TRUE, the version is created to delete the record.
should only be used from within DataHandler
Tags
Return values
int|null —Returns the id of the new version (if any)
versionPublishManyToManyRelations()
Handle MM relations attached to a record when publishing a workspace record.
public
versionPublishManyToManyRelations(string $table, array<string|int, mixed> $liveRecord, array<string|int, mixed> $workspaceRecord, int $fromWorkspace) : void
Strategy:
- Find all MM tables the record can be attached to by scanning TCA. Handle flex form "first level" fields too, but skip scanning for MM relations in container sections, since core does not support that since v7 - FormEngine throws an exception in this case.
- For each found MM table: Delete current MM rows of the live record, and update MM rows of the workspace record to now point to the live record.
Parameters
- $table : string
- $liveRecord : array<string|int, mixed>
- $workspaceRecord : array<string|int, mixed>
- $fromWorkspace : int
should only be used from within DataHandler
workspaceCannotEditOfflineVersion()
Evaluates if a user is allowed to edit the offline version
public
workspaceCannotEditOfflineVersion(string $table, array<string|int, mixed> $record) : string
Parameters
- $table : string
-
Table of record
- $record : array<string|int, mixed>
-
array where fields are at least: pid, t3ver_wsid, t3ver_stage (if versioningWS is set)
this method will be moved to EXT:workspaces
Tags
Return values
string —String error code, telling the failure state. FALSE=All ok
workspaceCannotEditRecord()
Checking if editing of an existing record is allowed in current workspace if that is offline.
public
workspaceCannotEditRecord(string $table, array<string|int, mixed>|int $recData) : string
Rules for editing in offline mode:
- record supports versioning and is an offline version from workspace and has the current stage
- or record (any) is in a branch where there is a page which is a version from the workspace and where the stage is not preventing records
Parameters
- $table : string
-
Table of record
- $recData : array<string|int, mixed>|int
-
Integer (record uid) or array where fields are at least: pid, t3ver_wsid, t3ver_oid, t3ver_stage (if versioningWS is set)
should only be used from within TYPO3 Core
Return values
string —String error code, telling the failure state. FALSE=All ok
_ACTION_FLEX_FORMdata()
Actions for flex form element (move, delete) allows to remove and move flexform sections
protected
_ACTION_FLEX_FORMdata(array<string|int, mixed> &$valueArray, array<string|int, mixed> $actionCMDs) : mixed
Parameters
- $valueArray : array<string|int, mixed>
-
by reference
- $actionCMDs : array<string|int, mixed>
addDefaultPermittedLanguageIfNotSet()
If a "languageField" is specified for $table this function will add a possible value to the incoming array if none is found in there already.
protected
addDefaultPermittedLanguageIfNotSet(string $table, array<string|int, mixed> &$incomingFieldArray, int $pageId) : void
Parameters
- $table : string
-
Table name
- $incomingFieldArray : array<string|int, mixed>
-
Incoming array (passed by reference)
- $pageId : int
-
the PID of the table (where the record should be inserted)
should only be used from within DataHandler
addDeleteRestriction()
Add delete restriction if not disabled
protected
addDeleteRestriction(QueryRestrictionContainerInterface $restrictions) : mixed
Parameters
- $restrictions : QueryRestrictionContainerInterface
addNewValuesToRemapStackChildIds()
Adds new values to the remapStackChildIds array.
protected
addNewValuesToRemapStackChildIds(array<string|int, mixed> $idValues) : mixed
Parameters
- $idValues : array<string|int, mixed>
-
uid values
applyDefaultsForFieldArray()
When a new record is created, all values that haven't been set but are set via PageTSconfig / UserTSconfig get applied here.
protected
applyDefaultsForFieldArray(string $table, int $pageId, array<string|int, mixed> $prepopulatedFieldArray) : array<string|int, mixed>
This is only executed for new records. The most important part is that the pageTS of the actual resolved $pid is taken, and a new field array with empty defaults is set again.
Parameters
- $table : string
- $pageId : int
- $prepopulatedFieldArray : array<string|int, mixed>
Return values
array<string|int, mixed>applyFiltersToValues()
Applies the filter methods from a column's TCA configuration to a value array.
protected
applyFiltersToValues(array<string|int, mixed> $tcaFieldConfiguration, array<string|int, mixed> $values) : array<string|int, mixed>|mixed
Parameters
- $tcaFieldConfiguration : array<string|int, mixed>
- $values : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>|mixedcastReferenceValue()
Casts a reference value. In case MM relations or foreign_field references are used. All other configurations, as well as foreign_table(!) could be stored as comma-separated-values as well. Since the system is not able to determine the default value automatically then, the TCA default value is used if it has been defined.
protected
castReferenceValue(int|string $value, array<string|int, mixed> $configuration, bool $isNew) : int|string
Parameters
- $value : int|string
-
The value to be casted (e.g. '', '0', '1,2,3')
- $configuration : array<string|int, mixed>
-
The TCA configuration of the accordant field
- $isNew : bool
-
is the record new or not
Return values
int|stringcheckForRecordsFromDisallowedTables()
Check if there are records from tables on the pages to be deleted which the current user is not allowed to
protected
checkForRecordsFromDisallowedTables(array<string|int, int> $pageIds) : array<string|int, string>|null
Parameters
- $pageIds : array<string|int, int>
-
IDs of pages which should be checked
Tags
Return values
array<string|int, string>|null —Return null, if permission granted, otherwise an array with the tables that are not allowed to be deleted
checkValue_inline_processDBdata()
Returns data for inline fields.
protected
checkValue_inline_processDBdata(array<string|int, mixed> $valueArray, array<string|int, mixed> $tcaFieldConf, int $id, string $status, string $table, string $field) : string
Parameters
- $valueArray : array<string|int, mixed>
-
Current value array
- $tcaFieldConf : array<string|int, mixed>
-
TCA field config
- $id : int
-
Record id
- $status : string
-
Status string ('update' or 'new')
- $table : string
-
Table name, needs to be passed to \TYPO3\CMS\Core\Database\RelationHandler
- $field : string
-
The current field the values are modified for
Return values
string —Modified values
checkValue_input_ValidateEmail()
If $value is not a valid e-mail address, $set will be set to false and a flash error message will be added
protected
checkValue_input_ValidateEmail(string $value, bool &$set, string $table, mixed $id) : mixed
Parameters
- $value : string
-
Value to evaluate
- $set : bool
-
TRUE if an update should be done
- $table : string
- $id : mixed
Tags
checkValueForCategory()
Evaluate 'category' type values
protected
checkValueForCategory(array<string|int, mixed> $result, string $value, array<string|int, mixed> $tcaFieldConf, string $table, int|string $id, string $status, string $field) : array<string|int, mixed>
Parameters
- $result : array<string|int, mixed>
-
The result array. The processed value (if any!) is set in the 'value' key.
- $value : string
-
The value to set.
- $tcaFieldConf : array<string|int, mixed>
-
Field configuration from TCA
- $table : string
-
Table name
- $id : int|string
-
uid of record
- $status : string
-
The status - 'update' or 'new' flag
- $field : string
-
Field name
Return values
array<string|int, mixed>checkValueForCheck()
Evaluates 'check' type values.
protected
checkValueForCheck(array<string|int, mixed> $res, string $value, array<string|int, mixed> $tcaFieldConf, string $table, int $id, int $realPid, string $field) : array<string|int, mixed>
Parameters
- $res : array<string|int, mixed>
-
The result array. The processed value (if any!) is set in the 'value' key.
- $value : string
-
The value to set.
- $tcaFieldConf : array<string|int, mixed>
-
Field configuration from TCA
- $table : string
-
Table name
- $id : int
-
UID of record
- $realPid : int
-
The real PID value of the record. For updates, this is just the pid of the record. For new records this is the PID of the page where it is inserted.
- $field : string
-
Field name
Return values
array<string|int, mixed> —Modified $res array
checkValueForFlex()
Evaluates 'flex' type values.
protected
checkValueForFlex(array<string|int, mixed> $res, string|array<string|int, mixed> $value, array<string|int, mixed> $tcaFieldConf, string $table, int $id, mixed $curValue, string $status, int $realPid, string $recFID, int $tscPID, string $field) : array<string|int, mixed>
Parameters
- $res : array<string|int, mixed>
-
The result array. The processed value (if any!) is set in the 'value' key.
- $value : string|array<string|int, mixed>
-
The value to set.
- $tcaFieldConf : array<string|int, mixed>
-
Field configuration from TCA
- $table : string
-
Table name
- $id : int
-
UID of record
- $curValue : mixed
-
Current value of the field
- $status : string
-
'update' or 'new' flag
- $realPid : int
-
The real PID value of the record. For updates, this is just the pid of the record. For new records this is the PID of the page where it is inserted.
- $recFID : string
-
Field identifier [table:uid:field] for flexforms
- $tscPID : int
-
TSconfig PID
- $field : string
-
Field name
Return values
array<string|int, mixed> —Modified $res array
checkValueForGroupSelect()
Evaluates 'group' or 'select' type values.
protected
checkValueForGroupSelect(array<string|int, mixed> $res, string|array<string|int, mixed> $value, array<string|int, mixed> $tcaFieldConf, string $table, int $id, string $status, string $field) : array<string|int, mixed>
Parameters
- $res : array<string|int, mixed>
-
The result array. The processed value (if any!) is set in the 'value' key.
- $value : string|array<string|int, mixed>
-
The value to set.
- $tcaFieldConf : array<string|int, mixed>
-
Field configuration from TCA
- $table : string
-
Table name
- $id : int
-
UID of record
- $status : string
-
'update' or 'new' flag
- $field : string
-
Field name
Return values
array<string|int, mixed> —Modified $res array
checkValueForInput()
Evaluate "input" type values.
protected
checkValueForInput(string $value, array<string|int, mixed> $tcaFieldConf, string $table, int $id, int $realPid, string $field) : array<string|int, mixed>
Parameters
- $value : string
-
The value to set.
- $tcaFieldConf : array<string|int, mixed>
-
Field configuration from TCA
- $table : string
-
Table name
- $id : int
-
UID of record
- $realPid : int
-
The real PID value of the record. For updates, this is just the pid of the record. For new records this is the PID of the page where it is inserted.
- $field : string
-
Field name
Return values
array<string|int, mixed> —$res The result array. The processed value (if any!) is set in the "value" key.
checkValueForInternalReferences()
Checks values that are used for internal references. If the provided $value is a NEW-identifier, the direct processing is stopped. Instead, the value is forwarded to the remap-stack to be post-processed and resolved into a proper UID after all data has been resolved.
protected
checkValueForInternalReferences(array<string|int, mixed> $res, string $value, array<string|int, mixed> $tcaFieldConf, string $table, int|string $id, string $field) : array<string|int, mixed>
This method considers TCA types that cannot handle and resolve these internal values directly, like 'passthrough', 'none' or 'user'. Values are only modified here if the $field is used as 'transOrigPointerField' or 'translationSource'.
Parameters
- $res : array<string|int, mixed>
-
The result array. The processed value (if any!) is set in the 'value' key.
- $value : string
-
The value to set.
- $tcaFieldConf : array<string|int, mixed>
-
Field configuration from TCA
- $table : string
-
Table name
- $id : int|string
-
UID of record
- $field : string
-
The field name
Return values
array<string|int, mixed> —The result array. The processed value (if any!) is set in the "value" key.
checkValueForLanguage()
Evaluate "language" type value.
protected
checkValueForLanguage(int $value, string $table, string $field) : array<string|int, mixed>
Checks whether the user is allowed to add such a value as language
Parameters
- $value : int
-
The value to set.
- $table : string
-
Table name
- $field : string
-
Field name
Return values
array<string|int, mixed> —$res The result array. The processed value (if any!) is set in the "value" key.
checkValueForRadio()
Evaluates 'radio' type values.
protected
checkValueForRadio(array<string|int, mixed> $res, string $value, array<string|int, mixed> $tcaFieldConf, string $table, int $id, int $pid, string $field) : array<string|int, mixed>
Parameters
- $res : array<string|int, mixed>
-
The result array. The processed value (if any!) is set in the 'value' key.
- $value : string
-
The value to set.
- $tcaFieldConf : array<string|int, mixed>
-
Field configuration from TCA
- $table : string
-
The table of the record
- $id : int
-
The id of the record
- $pid : int
-
The pid of the record
- $field : string
-
The field to check
Return values
array<string|int, mixed> —Modified $res array
checkValueForSlug()
Evaluate "slug" type values.
protected
checkValueForSlug(string $value, array<string|int, mixed> $tcaFieldConf, string $table, int $id, int $realPid, string $field[, array<string|int, mixed> $incomingFieldArray = [] ]) : array<string|int, mixed>
Parameters
- $value : string
-
The value to set.
- $tcaFieldConf : array<string|int, mixed>
-
Field configuration from TCA
- $table : string
-
Table name
- $id : int
-
UID of record
- $realPid : int
-
The real PID value of the record. For updates, this is just the pid of the record. For new records this is the PID of the page where it is inserted.
- $field : string
-
Field name
- $incomingFieldArray : array<string|int, mixed> = []
-
the fields being explicitly set by the outside (unlike $fieldArray) for the record
Tags
Return values
array<string|int, mixed> —$res The result array. The processed value (if any!) is set in the "value" key.
checkValueForText()
Evaluate "text" type values.
protected
checkValueForText(string|null $value, array<string|int, mixed> $tcaFieldConf, string $table, int $realPid, string $field) : array<string|int, mixed>
Parameters
- $value : string|null
-
The value to set.
- $tcaFieldConf : array<string|int, mixed>
-
Field configuration from TCA
- $table : string
-
Table name
- $realPid : int
-
The real PID value of the record. For updates, this is just the pid of the record. For new records this is the PID of the page where it is inserted.
- $field : string
-
Field name
Return values
array<string|int, mixed> —$res The result array. The processed value (if any!) is set in the "value" key.
controlActiveElements()
Controls active elements and sets NULL values if not active.
protected
controlActiveElements() : mixed
Datamap is modified accordant to submitted control values.
copy_remapTranslationSourceField()
Remap languageSource field to uids of newly created records
protected
copy_remapTranslationSourceField(string $table, array<string|int, mixed> $l10nRecords, array<string|int, mixed> $languageSourceMap) : mixed
Parameters
- $table : string
-
Table name
- $l10nRecords : array<string|int, mixed>
-
array of localized records from the page we're copying from (source records)
- $languageSourceMap : array<string|int, mixed>
-
array mapping source records uids to newly copied uids
copyRecord_processInline()
Processes child records in an inline (IRRE) element when the parent record is copied.
protected
copyRecord_processInline(string $table, int $uid, string $field, string $value, array<string|int, mixed> $row, array<string|int, mixed> $conf, int $realDestPid, int $language, array<string|int, mixed> $workspaceOptions) : string
Parameters
- $table : string
- $uid : int
- $field : string
- $value : string
- $row : array<string|int, mixed>
- $conf : array<string|int, mixed>
- $realDestPid : int
- $language : int
- $workspaceOptions : array<string|int, mixed>
Return values
stringcopyRecord_processManyToMany()
Processes the children of an MM relation field (select, group, inline) when the parent record is copied.
protected
copyRecord_processManyToMany(string $table, int $uid, string $field, string $value, array<string|int, mixed> $conf, int $language) : string
Parameters
- $table : string
- $uid : int
- $field : string
- $value : string
- $conf : array<string|int, mixed>
- $language : int
Return values
stringcreateRelationHandlerInstance()
protected
createRelationHandlerInstance() : RelationHandler
Return values
RelationHandlerdiscardCsvReferencesToRecord()
When the to-discard record is the target of a CSV group field of another table record, these records need to be updated to no longer point to the discarded record.
protected
discardCsvReferencesToRecord(string $table, array<string|int, mixed> $record) : void
Those referencing records are not very easy to find with only the to-discard record being available. The solution used here looks up records referencing the to-discard record by fetching a list of references from sys_refindex, where the to-discard record is on the right side (ref_* fields) and in the workspace the to-discard record lives in. The referencing record fields are then updated to drop the to-discard record from the CSV list.
Using sys_refindex for this task is a bit risky: This would fail if a DataHandler call adds a reference to the record and requests discarding the record in one call - the refindex is always only updated at the very end of a DataHandler call, the logic below wouldn't catch this since it would be based on an outdated sys_refindex. The scenario however is of little use and not used in core, so it should be fine.
Parameters
- $table : string
-
Table name of this record
- $record : array<string|int, mixed>
-
The record row to handle
discardLocalizationOverlayRecords()
Find localization overlays of a record and discard them.
protected
discardLocalizationOverlayRecords(string $table, array<string|int, mixed> $record) : void
Parameters
- $table : string
-
Table of this record
- $record : array<string|int, mixed>
-
Record row
discardLocalizedWorkspaceVersionsOfRecord()
When deleting a live element with sys_language_uid = 0, there may be translated records that have been created in workspaces only (t3ver_state=1). Those have to be discarded explicitly since the other 'delete' related code does not consider this case, otherwise the 'new' workspace translation would be dangling when the live record is gone.
protected
discardLocalizedWorkspaceVersionsOfRecord(string $table, int $uid) : void
Parameters
- $table : string
- $uid : int
discardMmRelations()
When a workspace record row is discarded that has mm relations, existing mm table rows need to be deleted. The method performs the delete operation depending on TCA field configuration.
protected
discardMmRelations(string $table, array<string|int, mixed> $fieldConfig, array<string|int, mixed> $record) : void
Parameters
- $table : string
-
Table name of this record
- $fieldConfig : array<string|int, mixed>
-
TCA configuration of this field
- $record : array<string|int, mixed>
-
The full record of a left- or ride-side relation
discardRecordRelations()
Discard record relations like inline and MM of a record.
protected
discardRecordRelations(string $table, array<string|int, mixed> $record) : void
Parameters
- $table : string
-
Table name of this record
- $record : array<string|int, mixed>
-
The record row to handle
discardSubPagesAndRecordsOnPage()
Also discard any sub pages and records of a new parent page if this page is discarded.
protected
discardSubPagesAndRecordsOnPage(array<string|int, mixed> $page) : void
Discarding only in specific localization, if needed.
Parameters
- $page : array<string|int, mixed>
-
Page record row
discardWorkspaceVersionsOfRecord()
Discard workspace overlays of a live record: When a live row is deleted, all existing workspace overlays are discarded.
protected
discardWorkspaceVersionsOfRecord(string $table, int $uid) : void
Parameters
- $table : string
-
Table name
- $uid : int
-
Record UID
should only be used from within DataHandler
doesRecordExist_pageLookUp()
Looks up a page based on permissions.
protected
doesRecordExist_pageLookUp(int $id, int $perms[, array<string|int, mixed> $columns = ['uid'] ]) : bool|array<string|int, mixed>
Parameters
- $id : int
-
Page id
- $perms : int
-
Permission integer
- $columns : array<string|int, mixed> = ['uid']
-
Columns to select
Tags
Return values
bool|array<string|int, mixed>fixUniqueInSite()
Checks if any uniqueInSite eval fields are in the record and if so, they are re-written to be correct.
protected
fixUniqueInSite(string $table, int $uid) : bool
Parameters
- $table : string
-
Table name
- $uid : int
-
Record UID
Return values
bool —whether the record had to be fixed or not
fixUniqueInSiteForSubpages()
Check if there are subpages that need an adoption as well
protected
fixUniqueInSiteForSubpages(int $pageId) : mixed
Parameters
- $pageId : int
formatLogDetails()
Replaces a string with placeholders (%s or {myPlaceholder}) with its substitutes.
protected
formatLogDetails(string $detailString, mixed $substitutes) : string
Parameters
- $detailString : string
- $substitutes : mixed
Return values
stringformatLogDetailsStatic()
Static version for ViewHelpers etc.
protected
static formatLogDetailsStatic(string $detailString, array<string|int, mixed> $substitutes) : string
Replaces a string with placeholders (%s or {myPlaceholder}) with its substitutes.
Parameters
- $detailString : string
- $substitutes : array<string|int, mixed>
Return values
stringgetAllowedTablesToCopyWhenCopyingAPage()
Compile a list of tables that should be copied along when a page is about to be copied.
protected
getAllowedTablesToCopyWhenCopyingAPage() : array<string|int, mixed>
First, get the list that the user is allowed to modify (all if admin), and then check against a possible limitation within "DataHandler->copyWhichTables" if not set to "*" to limit the list further down
Return values
array<string|int, mixed>getCacheManager()
Create and returns an instance of the CacheManager
protected
getCacheManager() : CacheManager
Return values
CacheManagergetCheckModifyAccessListHookObjects()
Gets the 'checkModifyAccessList' hook objects.
protected
getCheckModifyAccessListHookObjects() : array<string|int, mixed>
The first call initializes the accordant objects.
Tags
Return values
array<string|int, mixed> —The 'checkModifyAccessList' hook objects (if any)
getCommandMapElements()
Gets elements of the command map that match a particular command.
protected
getCommandMapElements(string $needle) : array<string|int, mixed>
Parameters
- $needle : string
-
The command to be matched
Return values
array<string|int, mixed>getDefaultLanguagePageId()
Find out if the record is a localization. If so, get the uid of the default language page.
protected
getDefaultLanguagePageId(int $pageId) : int
Always returns the uid of the workspace live record: No explicit workspace overlay is applied.
Parameters
- $pageId : int
-
Page UID, can be the default page record, or a page translation record ID
Return values
int —UID of the default page record in live workspace
getFieldEvalCacheIdentifier()
Return the cache entry identifier for field evals
protected
getFieldEvalCacheIdentifier(string $additionalIdentifier) : string
Parameters
- $additionalIdentifier : string
Return values
stringgetLanguageService()
protected
getLanguageService() : LanguageService
Return values
LanguageServicegetLocalTCE()
Returns an instance of DataHandler for handling local datamaps/cmdmaps
protected
getLocalTCE() : DataHandler
Return values
DataHandlergetOriginalParentOfRecord()
Gets UID of parent record. If record is deleted it will be looked up in an array built before the record was deleted
protected
getOriginalParentOfRecord(string $table, int $uid) : array<string|int, int>
Parameters
- $table : string
-
Table where record lives/lived
- $uid : int
-
Record UID
Return values
array<string|int, int> —Parent UIDs
getOuterMostInstance()
Gets the outer most instance of \TYPO3\CMS\Core\DataHandling\DataHandler Since \TYPO3\CMS\Core\DataHandling\DataHandler can create nested objects of itself, this method helps to determine the first (= outer most) one.
protected
getOuterMostInstance() : DataHandler
Return values
DataHandlergetPreviousLocalizedRecordUid()
Returning uid of "previous" localized record, if any, for tables with a "sortby" column.
protected
getPreviousLocalizedRecordUid(string $table, int $uid, int $pid, int $targetLanguage) : int
Used when records are localized, so that localized records are sorted in the same order as the source language records.
The uid of the returned record is later used to create the localized record "after" (higher sorting value) than the one the uid is returned of.
There are basically two scenarios:
- The localized record is to be placed as the first record of the target pid/language combination. In this case, there is no "before" record in this language. The method returns input $uid, saying "insert the localized record with a higher sorting value than the record the localization is created from".
- There is a localized record "before" (lower sorting value) in the target pid/language combination. For instance because source language element 2 is being translated and source language element 1 has already been translated. In this case, the uid of the 'element 1' is returned, saying "insert the localized record with a higher sorting value than the "before" record in this language.
The algorithm first fetches the record of given input uid. It then looks if there is a record with a lower sorting value for this pid/language combination. If no, input uid is returned ("place with higher sorting than source language record"). If yes, it looks if there is a localization of that source record in the target language and return the uid of that target language record ("place with higher sorting that this traget language record"). When dealing with table tt_content, colpos is also taken into account.
Parameters
- $table : string
-
Table name
- $uid : int
-
Uid of source language record
- $pid : int
-
Pid of source language record
- $targetLanguage : int
-
Target language id
Return values
int —uid of record after which the localized record should be inserted
getRecordHistoryStore()
protected
getRecordHistoryStore() : RecordHistoryStore
Return values
RecordHistoryStoregetResourceFactory()
Gets the resourceFactory
protected
getResourceFactory() : ResourceFactory
Return values
ResourceFactorygetRuntimeCache()
Gets an instance of the runtime cache.
protected
getRuntimeCache() : FrontendInterface
Return values
FrontendInterfacegetSiteLanguageForPage()
Find a site language by the given language ID for a specific page, and check for all available sites if the page ID is "0".
protected
getSiteLanguageForPage(int $pageId, int $languageId) : SiteLanguage|null
Note: Currently, the first language matching the given id is used, while there might be more languages with the same id in additional sites.
Parameters
- $pageId : int
- $languageId : int
Return values
SiteLanguage|nullgetUniqueCountStatement()
Gets the count of records for a unique field
protected
getUniqueCountStatement(string $value, string $table, string $field, int $uid, int $pid) : QueryBuilder
Parameters
- $value : string
-
The string value which should be unique
- $table : string
-
Table name
- $field : string
-
Field name for which $value must be unique
- $uid : int
-
UID to filter out in the lookup (the record itself...)
- $pid : int
-
If set, the value will be unique for this PID
Return values
QueryBuilder —Return the prepared statement to check uniqueness
hardDeleteSingleRecord()
Simple helper method to hard delete one row from table ignoring delete TCA field
protected
hardDeleteSingleRecord(string $table, int $uid) : void
Parameters
- $table : string
-
A row from this table should be deleted
- $uid : int
-
Uid of row to be deleted
increaseSortingOfFollowingRecords()
Increases sorting field value of all records with sorting higher than $sortingValue
protected
increaseSortingOfFollowingRecords(string $table, int $pid[, int|null $sortingValue = null ]) : void
Used internally by getSortNumber() to "make space" in sorting values when inserting new record
Parameters
- $table : string
-
Table name
- $pid : int
-
Page Uid in which to resort records
- $sortingValue : int|null = null
-
All sorting numbers larger than this number will be shifted
Tags
inlineLocalizeSynchronize()
Performs localization or synchronization of child records.
protected
inlineLocalizeSynchronize(string $table, int $id, array<string|int, mixed>|string $command) : mixed
The $command argument expects an array, but supports a string for backward-compatibility.
$command = array( 'field' => 'tx_myfieldname', 'language' => 2, // either the key 'action' or 'ids' must be set 'action' => 'synchronize', // or 'localize' 'ids' => array(1, 2, 3, 4) // child element ids );
Parameters
- $table : string
-
The table of the localized parent record
- $id : int
-
The uid of the localized parent record
- $command : array<string|int, mixed>|string
-
Defines the command to be performed (see example above)
isElementToBeDeleted()
Determines whether an element was registered to be deleted in the registry.
protected
isElementToBeDeleted(string $table, int $id) : bool
Parameters
- $table : string
-
Name of the table
- $id : int
-
Uid of the record
Tags
Return values
boolisNestedElementCallRegistered()
Determines nested element calls.
protected
isNestedElementCallRegistered(string $table, int $id, string $identifier) : bool
Parameters
- $table : string
-
Name of the table
- $id : int
-
Uid of the record
- $identifier : string
-
Name of the action to be checked
Return values
boolisRecordLocalized()
Returns true if a localization of a record exists.
protected
isRecordLocalized(string $table, int $uid, int $language) : bool
Parameters
- $table : string
- $uid : int
- $language : int
Return values
boolisSubmittedValueEqualToStoredValue()
Determines whether submitted values and stored values are equal.
protected
isSubmittedValueEqualToStoredValue(mixed $submittedValue, mixed $storedValue, string $storedType[, bool $allowNull = false ]) : bool
This prevents from adding superfluous field changes which would be shown in the record history as well. For NULL fields (see accordant TCA definition 'eval' = 'null'), a special handling is required since (!strcmp(NULL, '')) would be a false-positive.
Parameters
- $submittedValue : mixed
-
Value that has submitted (e.g. from a backend form)
- $storedValue : mixed
-
Value that is currently stored in the database
- $storedType : string
-
SQL type of the stored value column (see mysql_field_type(), e.g 'int', 'string', ...)
- $allowNull : bool = false
-
Whether NULL values are allowed by accordant TCA definition ('eval' = 'null')
Return values
bool —Whether both values are considered to be equal
normalizeTimeFormat()
protected
normalizeTimeFormat(string $table, string $value, string $dbType) : string
Parameters
- $table : string
- $value : string
- $dbType : string
Return values
stringoverlayAutoVersionId()
Overlays the automatically versionized id of a record.
protected
overlayAutoVersionId(string $table, int $id) : int
Parameters
- $table : string
-
Name of the table
- $id : int
-
Uid of the record
Return values
intpostProcessDatabaseInsert()
Entry point to post process a database insert. Currently bails early unless a UID has been forced and the database platform is not MySQL.
protected
postProcessDatabaseInsert(Connection $connection, string $tableName, int $suggestedUid) : int
Parameters
- $connection : Connection
- $tableName : string
- $suggestedUid : int
Return values
intpostProcessPostgresqlInsert()
PostgreSQL works with sequences for auto increment columns. A sequence is not updated when a value is written to such a column. To avoid clashes when the sequence returns an existing ID this helper will update the sequence to the current max value of the column.
protected
postProcessPostgresqlInsert(Connection $connection, string $tableName) : mixed
Parameters
- $connection : Connection
- $tableName : string
postProcessSqlServerInsert()
Get the last insert ID from sql server
protected
postProcessSqlServerInsert(Connection $connection, string $tableName) : int
- first checks whether doctrine might be able to fetch the ID from the sequence table
- if that does not succeed it manually selects the current IDENTITY value from a table
- returns 0 if both fail
Parameters
- $connection : Connection
- $tableName : string
Tags
Return values
intprepareCacheFlush()
Prepare the cache clearing
protected
prepareCacheFlush(string $table, int $uid, int $pid) : array<string|int, mixed>
Parameters
- $table : string
-
Table name of record that needs to be cleared
- $uid : int
-
UID of record for which the cache needs to be cleared
- $pid : int
-
Original pid of the page of the record which the cache needs to be cleared
This function is internal only it may be changed/removed also in minor version numbers.
Return values
array<string|int, mixed> —Array with tagsToClear and clearCacheCommands
processClearCacheQueue()
Do the actual clear cache
protected
processClearCacheQueue() : mixed
recordInfoWithPermissionCheck()
Checks if record exists with and without permission check and returns that row
protected
recordInfoWithPermissionCheck(string $table, int $id, int $perms[, string $fieldList = '*' ]) : array<string, mixed>|false
Parameters
- $table : string
-
Record table name
- $id : int
-
Record UID
- $perms : int
-
Permission restrictions to observe: An integer that will be bitwise AND'ed.
- $fieldList : string = '*'
-
- fields - default is '*'
Tags
Return values
array<string, mixed>|false —Row if exists and accessible, false otherwise
registerElementsToBeDeleted()
Registers elements to be deleted in the registry.
protected
registerElementsToBeDeleted() : mixed
Tags
registerNestedElementCall()
Registers nested elements calls.
protected
registerNestedElementCall(string $table, int $id, string $identifier) : mixed
This is used to track nested calls (e.g. for following m:n relations).
Parameters
- $table : string
-
Name of the table
- $id : int
-
Uid of the record
- $identifier : string
-
Name of the action to be tracked
resetElementsToBeDeleted()
Resets the elements to be deleted in the registry.
protected
resetElementsToBeDeleted() : mixed
Tags
resetNestedElementCalls()
Resets the nested element calls.
protected
resetNestedElementCalls() : mixed
resolveFieldConfigurationAndRespectColumnsOverrides()
Use columns overrides for evaluation.
protected
resolveFieldConfigurationAndRespectColumnsOverrides(string $table, string $field) : array<string|int, mixed>
Fetch the TCA ["config"] part for a specific field, including the columnsOverrides value. Used for checkValue purposes currently (as it takes the checkValue_currentRecord value).
Parameters
- $table : string
- $field : string
Return values
array<string|int, mixed>resolveSortingAndPidForNewRecord()
Sets the "sorting" DB field and the "pid" field of an incoming record that should be added (NEW1234) depending on the record that should be added or where it should be added.
protected
resolveSortingAndPidForNewRecord(string $table, int $pid, array<string|int, mixed> $fieldArray) : array<string|int, mixed>
This method is called from process_datamap()
Parameters
- $table : string
-
the table name of the record to insert
- $pid : int
-
the real PID (numeric) where the record should be
- $fieldArray : array<string|int, mixed>
-
field+value pairs to add
Return values
array<string|int, mixed> —the modified field array
resolveVersionedRecords()
Resolves versioned records for the current workspace scope.
protected
resolveVersionedRecords(string $tableName, string $fieldNames, string $sortingField, array<string|int, mixed> $liveIds) : array<string|int, mixed>
Delete placeholders are substituted and removed.
Parameters
- $tableName : string
-
Name of the table to be processed
- $fieldNames : string
-
List of the field names to be fetched
- $sortingField : string
-
Name of the sorting field to be used
- $liveIds : array<string|int, mixed>
-
Flat array of (live) record ids
Return values
array<string|int, mixed>setNullValues()
Sets NULL values in haystack array.
protected
setNullValues(array<string|int, mixed> $active, array<string|int, mixed> &$haystack) : mixed
The general behaviour in the user interface is to enable/activate fields. Thus, this method uses NULL as value to be stored if a field is not active.
Parameters
- $active : array<string|int, mixed>
-
hierarchical array with active elements
- $haystack : array<string|int, mixed>
-
hierarchical array with haystack to be modified
undeleteRecord()
Restore live records by setting soft-delete flag to 0.
protected
undeleteRecord(string $table, int $uid) : void
Usually only used by ext:recycler. Connected relations (eg. inline) are restored, too. Additional existing localizations are not restored.
Parameters
- $table : string
-
Record table name
- $uid : int
-
Record uid
undeleteRecordRelations()
Check if a to-restore record has inline references and restore them.
protected
undeleteRecordRelations(string $table, int $uid, array<string|int, mixed> $record) : void
Parameters
- $table : string
-
Record table name
- $uid : int
-
Record uid
- $record : array<string|int, mixed>
-
Record row
Tags
unserializeLogData()
Useful for handling old serialized data, which might have been migrated to JSON encoded properties already.
protected
unserializeLogData(mixed $logData) : array<string|int, mixed>|null
Parameters
- $logData : mixed
Return values
array<string|int, mixed>|nullunsetElementsToBeDeleted()
Unsets elements (e.g. of the data map) that shall be deleted.
protected
unsetElementsToBeDeleted(array<string|int, mixed> $elements) : array<string|int, mixed>
This avoids to modify records that will be deleted later on.
Parameters
- $elements : array<string|int, mixed>
-
Elements to be modified
Return values
array<string|int, mixed>updateFlexFormData()
Updates FlexForm data.
protected
updateFlexFormData(string $flexFormId, array<string|int, mixed> $modifications) : mixed
Parameters
- $flexFormId : string
-
e.g.