TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Backend\Form\DataPreprocessor Class Reference
Inheritance diagram for TYPO3\CMS\Backend\Form\DataPreprocessor:
t3lib_transferData

Public Member Functions

 fetchRecord ($table, $idList, $operation)
 
 renderRecord ($table, $id, $pid, $row)
 
 renderRecordRaw ($table, $id, $pid, $row, $TSconfig='', $tscPID=0)
 
 renderRecord_SW ($data, $fieldConfig, $TSconfig, $table, $row, $field)
 
 renderRecord_selectProc ($data, $fieldConfig, $TSconfig, $table, $row, $field)
 
 renderRecord_flexProc ($data, $fieldConfig, $TSconfig, $table, $row, $field)
 
 renderRecord_typesProc ($totalRecordContent, $types_fieldConfig, $tscPID, $table, $pid)
 
 renderRecord_inlineProc ($data, $fieldConfig, $TSconfig, $table, $row, $field)
 
 renderRecord_flexProc_procInData ($dataPart, $dataStructArray, $pParams)
 
 renderRecord_flexProc_procInData_travDS (&$dataValues, $DSelements, $pParams)
 
 selectAddSpecial ($dataAcc, $elements, $specialKey)
 
 selectAddForeign ($dataAcc, $elements, $fieldConfig, $field, $TSconfig, $row, $table)
 
 getDataIdList ($elements, $fieldConfig, $row, $table)
 
 procesItemArray ($selItems, $config, $fieldTSConfig, $table, $row, $field)
 
 addItems ($items, $iArray)
 
 procItems ($items, $itemsProcFuncTSconfig, $config, $table, $row, $field)
 
 lockRecord ($table, $id, $pid=0)
 
 regItem ($table, $id, $field, $content)
 
 sL ($in)
 

Public Attributes

 $lockRecords = 0
 
 $disableRTE = 0
 
 $prevPageID = ''
 
 $defVals = array()
 
 $addRawData = FALSE
 
 $regTableItems = array()
 
 $regTableItems_data = array()
 
 $loadModules = ''
 

Protected Member Functions

 getLiveDefaultId ($tableName, $id)
 

Detailed Description

Class for getting and transforming data for display in backend forms (TCEforms)

Author
Kasper Skårhøj kaspe.nosp@m.rYYY.nosp@m.Y@typ.nosp@m.o3.c.nosp@m.om

Definition at line 26 of file DataPreprocessor.php.

Member Function Documentation

◆ addItems()

TYPO3\CMS\Backend\Form\DataPreprocessor::addItems (   $items,
  $iArray 
)

Adding items from $iArray to $items array

Parameters
array$itemsThe array of selector box items to which key(value) / value(label) pairs from $iArray will be added.
array$iArrayThe array of elements to add. The keys will become values. The value will become the label.
Returns
array The modified input $items array private
See also
procesItemArray()
Todo:
Define visibility

Definition at line 854 of file DataPreprocessor.php.

Referenced by TYPO3\CMS\Backend\Form\DataPreprocessor\procesItemArray().

◆ fetchRecord()

TYPO3\CMS\Backend\Form\DataPreprocessor::fetchRecord (   $table,
  $idList,
  $operation 
)

A function which can be used for load a batch of records from $table into internal memory of this object. The function is also used to produce proper default data for new records Ultimately the function will call renderRecord()

Parameters
string$tableTable name, must be found in $GLOBALS['TCA']
string$idListComma list of id values. If $idList is "prev" then the value from $this->prevPageID is used. NOTICE: If $operation is "new", then negative ids are meant to point to a "previous" record and positive ids are PID values for new records. Otherwise (for existing records that is) it is straight forward table/id pairs.
string$operationIf "new", then a record with default data is returned. Further, the $id values are meant to be PID values (or if negative, pointing to a previous record). If NOT new, then the table/ids are just pointing to an existing record!
Returns
void
See also
renderRecord()
Todo:
Define visibility

Definition at line 95 of file DataPreprocessor.php.

References $GLOBALS, TYPO3\CMS\Backend\Form\DataPreprocessor\$prevPageID, TYPO3\CMS\Backend\Utility\BackendUtility\deleteClause(), TYPO3\CMS\Backend\Utility\BackendUtility\fixVersioningPid(), TYPO3\CMS\Backend\Utility\BackendUtility\getPagesTSconfig(), TYPO3\CMS\Backend\Form\DataPreprocessor\lockRecord(), TYPO3\CMS\Backend\Form\DataPreprocessor\renderRecord(), and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

◆ getDataIdList()

TYPO3\CMS\Backend\Form\DataPreprocessor::getDataIdList (   $elements,
  $fieldConfig,
  $row,
  $table 
)

Returning the id-list processed by loadDBgroup for the foreign tables.

Parameters
array$elementsThe array of original elements - basically the field value exploded by ",
array$fieldConfigField configuration from TCA
array$rowThe data array, currently. Used to set the "local_uid" for selecting MM relation records.
string$tableCurrent table name. passed on to
Returns
array An array with ids of the records from the input elements array. private
Todo:
Define visibility

Definition at line 808 of file DataPreprocessor.php.

References TYPO3\CMS\Backend\Form\DataPreprocessor\getLiveDefaultId(), and TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

Referenced by TYPO3\CMS\Backend\Form\DataPreprocessor\renderRecord_inlineProc(), TYPO3\CMS\Backend\Form\DataPreprocessor\renderRecord_selectProc(), and TYPO3\CMS\Backend\Form\DataPreprocessor\selectAddForeign().

◆ getLiveDefaultId()

TYPO3\CMS\Backend\Form\DataPreprocessor::getLiveDefaultId (   $tableName,
  $id 
)
protected

Gets the record uid of the live default record. If already pointing to the live record, the submitted record uid is returned.

Parameters
string$tableName
int$id
Returns
int

Definition at line 945 of file DataPreprocessor.php.

References TYPO3\CMS\Backend\Utility\BackendUtility\getLiveVersionIdOfRecord().

Referenced by TYPO3\CMS\Backend\Form\DataPreprocessor\getDataIdList().

◆ lockRecord()

TYPO3\CMS\Backend\Form\DataPreprocessor::lockRecord (   $table,
  $id,
  $pid = 0 
)

Sets the lock for a record from table/id, IF $this->lockRecords is set!

Parameters
string$tableThe table name
integer$idThe id of the record
integer$pidThe pid of the record
Returns
void
Todo:
Define visibility

Definition at line 903 of file DataPreprocessor.php.

References TYPO3\CMS\Backend\Utility\BackendUtility\lockRecords().

Referenced by TYPO3\CMS\Backend\Form\DataPreprocessor\fetchRecord().

◆ procesItemArray()

TYPO3\CMS\Backend\Form\DataPreprocessor::procesItemArray (   $selItems,
  $config,
  $fieldTSConfig,
  $table,
  $row,
  $field 
)

Processing of selector box items. This includes the automated adding of elements plus user-function processing.

Parameters
arrayThe elements to process
arrayTCA/columns configuration
arrayTSconfig for the field
stringThe table name
arrayThe current row
stringThe field name
Returns
array The modified input $selItems array private
See also
renderRecord_selectProc()
Todo:
Define visibility

Definition at line 836 of file DataPreprocessor.php.

References TYPO3\CMS\Backend\Form\DataPreprocessor\addItems(), and TYPO3\CMS\Backend\Form\DataPreprocessor\procItems().

Referenced by TYPO3\CMS\Backend\Form\DataPreprocessor\renderRecord_selectProc().

◆ procItems()

TYPO3\CMS\Backend\Form\DataPreprocessor::procItems (   $items,
  $itemsProcFuncTSconfig,
  $config,
  $table,
  $row,
  $field 
)

User processing of a selector box array of values.

Parameters
array$itemsThe array of selector box items
array$itemsProcFuncTSconfigTSconfig for the fields itemProcFunc
array$configTCA/columns configuration
string$tableThe table name
array$rowThe current row
string$fieldThe field name
Returns
array The modified input $items array private
See also
procesItemArray()
Todo:
Define visibility

Definition at line 877 of file DataPreprocessor.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\callUserFunction().

Referenced by TYPO3\CMS\Backend\Form\DataPreprocessor\procesItemArray().

◆ regItem()

TYPO3\CMS\Backend\Form\DataPreprocessor::regItem (   $table,
  $id,
  $field,
  $content 
)

Dummy function, can be used to "register" records. Used by eg. the "show_item" script.

Parameters
string$tableTable name
integer$idRecord id
string$fieldField name
string$contentField content.
Returns
void private
See also
renderRecord()
Todo:
Define visibility

Definition at line 921 of file DataPreprocessor.php.

Referenced by TYPO3\CMS\Backend\Form\DataPreprocessor\renderRecordRaw().

◆ renderRecord()

TYPO3\CMS\Backend\Form\DataPreprocessor::renderRecord (   $table,
  $id,
  $pid,
  $row 
)

This function performs processing on the input $row array and stores internally a corresponding array which contains processed values, ready to pass on to the TCEforms rendering in the frontend! The objective with this function is to prepare the content for handling in TCEforms. Default values from outside/TSconfig is added by fetchRecord(). In this function default values from TCA is used if a field is NOT defined in $row. The resulting, processed row is stored in $this->regTableItems_data[$uniqueItemRef], where $uniqueItemRef is "[tablename]_[id-value]"

Parameters
string$tableThe table name
string$idThe uid value of the record (integer). Can also be a string (NEW-something) if the record is a NEW record.
integer$pidThe pid integer. For existing records this is of course the row's "pid" field. For new records it can be either a page id (positive) or a pointer to another record from the SAME table (negative) after which the record should be inserted (or on same page)
array$rowThe row of the current record. If NEW record, then it may be loaded with default values (by eg. fetchRecord()).
Returns
void
See also
fetchRecord()
Todo:
Define visibility

Definition at line 193 of file DataPreprocessor.php.

References $GLOBALS, TYPO3\CMS\Backend\Utility\BackendUtility\getTCEFORM_TSconfig(), TYPO3\CMS\Backend\Utility\BackendUtility\getTSCpid(), TYPO3\CMS\Core\Utility\GeneralUtility\inList(), and TYPO3\CMS\Backend\Form\DataPreprocessor\renderRecordRaw().

Referenced by TYPO3\CMS\Backend\Form\DataPreprocessor\fetchRecord().

◆ renderRecord_flexProc()

TYPO3\CMS\Backend\Form\DataPreprocessor::renderRecord_flexProc (   $data,
  $fieldConfig,
  $TSconfig,
  $table,
  $row,
  $field 
)

Processing of the data value in case the field type is "flex" MUST NOT be called in case of already INSIDE a flexform!

Parameters
string$dataThe field value
array$fieldConfigCA field config
array$TSconfigTCEform TSconfig for the record
string$tableTable name
array$rowThe row
string$fieldField name
Returns
string The processed input field value ($data) private
See also
renderRecord()
Todo:
Define visibility

Definition at line 439 of file DataPreprocessor.php.

References TYPO3\CMS\Backend\Utility\BackendUtility\getFlexFormDS(), TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance(), TYPO3\CMS\Backend\Form\DataPreprocessor\renderRecord_flexProc_procInData(), and TYPO3\CMS\Core\Utility\GeneralUtility\xml2array().

Referenced by TYPO3\CMS\Backend\Form\DataPreprocessor\renderRecord_SW().

◆ renderRecord_flexProc_procInData()

TYPO3\CMS\Backend\Form\DataPreprocessor::renderRecord_flexProc_procInData (   $dataPart,
  $dataStructArray,
  $pParams 
)

Function traversing sheets/languages for flex form data structures

Parameters
array$dataPartData array
array$dataStructArrayData Structure array
array$pParamsVarious parameters to pass-through
Returns
array Modified $dataPart array. private
See also
::checkValue_flex_procInData(), renderRecord_flexProc_procInData_travDS()
Todo:
Define visibility

Definition at line 549 of file DataPreprocessor.php.

References TYPO3\CMS\Backend\Form\DataPreprocessor\renderRecord_flexProc_procInData_travDS(), and TYPO3\CMS\Core\Utility\GeneralUtility\resolveSheetDefInDS().

Referenced by TYPO3\CMS\Backend\Form\DataPreprocessor\renderRecord_flexProc().

◆ renderRecord_flexProc_procInData_travDS()

TYPO3\CMS\Backend\Form\DataPreprocessor::renderRecord_flexProc_procInData_travDS ( $dataValues,
  $DSelements,
  $pParams 
)

Traverse data array / structure

Parameters
array$dataValuesData array passed by reference.
array$DSelementsData structure
array$pParamsVarious parameters pass-through.
Returns
void
See also
::checkValue_flex_procInData(), renderRecord_flexProc_procInData_travDS()
Todo:
Define visibility

Definition at line 573 of file DataPreprocessor.php.

References TYPO3\CMS\Backend\Form\DataPreprocessor\renderRecord_SW().

Referenced by TYPO3\CMS\Backend\Form\DataPreprocessor\renderRecord_flexProc_procInData().

◆ renderRecord_inlineProc()

TYPO3\CMS\Backend\Form\DataPreprocessor::renderRecord_inlineProc (   $data,
  $fieldConfig,
  $TSconfig,
  $table,
  $row,
  $field 
)

Processing of the data value in case the field type is "inline" In some parts nearly the same as type "select"

Parameters
string$dataThe field value
array$fieldConfigTCA field config
array$TSconfigTCEform TSconfig for the record
string$tableTable name
array$rowThe row
string$fieldField name
Returns
string The processed input field value ($data) private
See also
renderRecord()
Todo:
Define visibility

Definition at line 509 of file DataPreprocessor.php.

References TYPO3\CMS\Backend\Form\DataPreprocessor\getDataIdList(), and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

Referenced by TYPO3\CMS\Backend\Form\DataPreprocessor\renderRecord_SW().

◆ renderRecord_selectProc()

TYPO3\CMS\Backend\Form\DataPreprocessor::renderRecord_selectProc (   $data,
  $fieldConfig,
  $TSconfig,
  $table,
  $row,
  $field 
)

Processing of the data value in case the field type is "select"

Parameters
string$dataThe field value
array$fieldConfigTCA field config
array$TSconfigTCEform TSconfig for the record
string$tableTable name
array$rowThe row
string$fieldField name
Returns
string The processed input field value ($data) private
See also
renderRecord()
Todo:
Define visibility

Definition at line 378 of file DataPreprocessor.php.

References $GLOBALS, TYPO3\CMS\Backend\Form\DataPreprocessor\getDataIdList(), TYPO3\CMS\Backend\Form\DataPreprocessor\procesItemArray(), TYPO3\CMS\Backend\Form\DataPreprocessor\selectAddForeign(), TYPO3\CMS\Backend\Form\DataPreprocessor\selectAddSpecial(), TYPO3\CMS\Backend\Form\DataPreprocessor\sL(), and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

Referenced by TYPO3\CMS\Backend\Form\DataPreprocessor\renderRecord_SW().

◆ renderRecord_SW()

TYPO3\CMS\Backend\Form\DataPreprocessor::renderRecord_SW (   $data,
  $fieldConfig,
  $TSconfig,
  $table,
  $row,
  $field 
)

Function with the switch() construct which triggers functions for processing of the data value depending on the TCA-config field type.

Parameters
string$dataValue to process
array$fieldConfigTCA/columns array for field (independant of TCA for flexforms - coming from XML then)
array$TSconfigTSconfig (blank for flexforms for now)
string$tableTable name
array$rowThe row array, always of the real record (also for flexforms)
string$fieldThe field
Returns
string Modified $value
Todo:
Define visibility

Definition at line 294 of file DataPreprocessor.php.

References TYPO3\CMS\Core\Utility\PathUtility\basename(), TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance(), TYPO3\CMS\Backend\Form\DataPreprocessor\renderRecord_flexProc(), TYPO3\CMS\Backend\Form\DataPreprocessor\renderRecord_inlineProc(), TYPO3\CMS\Backend\Form\DataPreprocessor\renderRecord_selectProc(), and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

Referenced by TYPO3\CMS\Backend\Form\DataPreprocessor\renderRecord_flexProc_procInData_travDS(), and TYPO3\CMS\Backend\Form\DataPreprocessor\renderRecordRaw().

◆ renderRecord_typesProc()

TYPO3\CMS\Backend\Form\DataPreprocessor::renderRecord_typesProc (   $totalRecordContent,
  $types_fieldConfig,
  $tscPID,
  $table,
  $pid 
)

Processing of the content in $totalRecordcontent based on settings in the types-configuration

Parameters
array$totalRecordContentThe array of values which has been processed according to their type (eg. "group" or "select")
array$types_fieldConfigThe "types" configuration for the current display of fields.
integer$tscPIDPAGE TSconfig PID
string$tableTable name
integer$pidPID value
Returns
array The processed version of $totalRecordContent private
Todo:
Define visibility

Definition at line 476 of file DataPreprocessor.php.

References TYPO3\CMS\Core\Html\RteHtmlParser\evalWriteFile(), TYPO3\CMS\Core\Utility\GeneralUtility\getUrl(), and TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

Referenced by TYPO3\CMS\Backend\Form\DataPreprocessor\renderRecordRaw().

◆ renderRecordRaw()

TYPO3\CMS\Backend\Form\DataPreprocessor::renderRecordRaw (   $table,
  $id,
  $pid,
  $row,
  $TSconfig = '',
  $tscPID = 0 
)

This function performs processing on the input $row array and stores internally a corresponding array which contains processed values, ready to pass on to the TCEforms rendering in the frontend! The objective with this function is to prepare the content for handling in TCEforms. In opposite to renderRecord() this function do not prepare things like fetching TSconfig and others. The resulting, processed row will be returned.

Parameters
string$tableThe table name
string$idThe uid value of the record (integer). Can also be a string (NEW-something) if the record is a NEW record.
integer$pidThe pid integer. For existing records this is of course the row's "pid" field. For new records it can be either a page id (positive) or a pointer to another record from the SAME table (negative) after which the record should be inserted (or on same page)
array$rowThe row of the current record. If NEW record, then it may be loaded with default values (by eg. fetchRecord()).
array$TSconfigTsconfig array
integer$tscPIDPAGE TSconfig pid
Returns
array Processed record data
See also
renderRecord()
Todo:
Define visibility

Definition at line 238 of file DataPreprocessor.php.

References $GLOBALS, TYPO3\CMS\Backend\Utility\BackendUtility\getTCAtypes(), TYPO3\CMS\Core\Utility\GeneralUtility\inList(), TYPO3\CMS\Backend\Form\DataPreprocessor\regItem(), TYPO3\CMS\Backend\Form\DataPreprocessor\renderRecord_SW(), and TYPO3\CMS\Backend\Form\DataPreprocessor\renderRecord_typesProc().

Referenced by TYPO3\CMS\Backend\Form\DataPreprocessor\renderRecord().

◆ selectAddForeign()

TYPO3\CMS\Backend\Form\DataPreprocessor::selectAddForeign (   $dataAcc,
  $elements,
  $fieldConfig,
  $field,
  $TSconfig,
  $row,
  $table 
)

Adds the foreign record elements to $dataAcc, if any

Parameters
array$dataAccArray with numeric keys, containing values for the selector box, prepared for interface. We are going to add elements to this array as needed.
array$elementsThe array of original elements - basically the field value exploded by ",
array$fieldConfigField configuration from TCA
string$fieldThe field name
array$TSconfigTSconfig for the record
array$rowThe record
array$tableThe current table
Returns
array Modified $dataAcc array private
See also
renderRecord_selectProc()
Todo:
Define visibility

Definition at line 751 of file DataPreprocessor.php.

References $GLOBALS, TYPO3\CMS\Backend\Utility\BackendUtility\exec_foreign_table_where_query(), TYPO3\CMS\Core\Utility\GeneralUtility\fixed_lgd_cs(), TYPO3\CMS\Backend\Form\DataPreprocessor\getDataIdList(), TYPO3\CMS\Backend\Utility\BackendUtility\getRecordTitle(), TYPO3\CMS\Backend\Form\DataPreprocessor\sL(), and TYPO3\CMS\Backend\Utility\BackendUtility\workspaceOL().

Referenced by TYPO3\CMS\Backend\Form\DataPreprocessor\renderRecord_selectProc().

◆ selectAddSpecial()

TYPO3\CMS\Backend\Form\DataPreprocessor::selectAddSpecial (   $dataAcc,
  $elements,
  $specialKey 
)

Adding "special" types to the $dataAcc array of selector items

Parameters
array$dataAccArray with numeric keys, containing values for the selector box, prepared for interface. We are going to add elements to this array as needed.
array$elementsThe array of original elements - basically the field value exploded by ", @param string $specialKey The "special" key from the TCA config of the field. Determines the type of processing in here.
Returns
array Modified $dataAcc array private
See also
renderRecord_selectProc()
Todo:
Define visibility

Definition at line 630 of file DataPreprocessor.php.

References $GLOBALS, TYPO3\CMS\Backend\Utility\BackendUtility\getExcludeFields(), TYPO3\CMS\Backend\Utility\BackendUtility\getExplicitAuthFieldValues(), TYPO3\CMS\Backend\Utility\BackendUtility\getSystemLanguages(), TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance(), and TYPO3\CMS\Backend\Form\DataPreprocessor\sL().

Referenced by TYPO3\CMS\Backend\Form\DataPreprocessor\renderRecord_selectProc().

◆ sL()

TYPO3\CMS\Backend\Form\DataPreprocessor::sL (   $in)

Local wrapper function for LANG->sL (returning language labels)

Parameters
stringLanguage label key
Returns
string Localized label value. private
Todo:
Define visibility

Definition at line 933 of file DataPreprocessor.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Backend\Form\DataPreprocessor\renderRecord_selectProc(), TYPO3\CMS\Backend\Form\DataPreprocessor\selectAddForeign(), and TYPO3\CMS\Backend\Form\DataPreprocessor\selectAddSpecial().

Member Data Documentation

◆ $addRawData

TYPO3\CMS\Backend\Form\DataPreprocessor::$addRawData = FALSE
Todo:
Define visibility

Definition at line 57 of file DataPreprocessor.php.

◆ $defVals

TYPO3\CMS\Backend\Form\DataPreprocessor::$defVals = array()
Todo:
Define visibility

Definition at line 51 of file DataPreprocessor.php.

◆ $disableRTE

TYPO3\CMS\Backend\Form\DataPreprocessor::$disableRTE = 0
Todo:
Define visibility

Definition at line 39 of file DataPreprocessor.php.

◆ $loadModules

TYPO3\CMS\Backend\Form\DataPreprocessor::$loadModules = ''
Todo:
Define visibility

Definition at line 76 of file DataPreprocessor.php.

◆ $lockRecords

TYPO3\CMS\Backend\Form\DataPreprocessor::$lockRecords = 0
Todo:
Define visibility

Definition at line 33 of file DataPreprocessor.php.

◆ $prevPageID

TYPO3\CMS\Backend\Form\DataPreprocessor::$prevPageID = ''
Todo:
Define visibility

Definition at line 45 of file DataPreprocessor.php.

Referenced by TYPO3\CMS\Backend\Form\DataPreprocessor\fetchRecord().

◆ $regTableItems

TYPO3\CMS\Backend\Form\DataPreprocessor::$regTableItems = array()
Todo:
Define visibility

Definition at line 64 of file DataPreprocessor.php.

◆ $regTableItems_data

TYPO3\CMS\Backend\Form\DataPreprocessor::$regTableItems_data = array()
Todo:
Define visibility

Definition at line 70 of file DataPreprocessor.php.