* @param string $field Field name. Must NOT be set if the call is for a flexform field (since flexforms are not allowed within flexforms).
* @param [type] $uploadedFiles
* @param [type] $tscPID
+ * @param array $additionalData Additional data to be forwarded to sub-processors
* @return array Returns the evaluated $value as key "value" in this array.
* @todo Define visibility
*/
- public function checkValue_SW($res, $value, $tcaFieldConf, $table, $id, $curValue, $status, $realPid, $recFID, $field, $uploadedFiles, $tscPID) {
+ public function checkValue_SW($res, $value, $tcaFieldConf, $table, $id, $curValue, $status, $realPid, $recFID, $field, $uploadedFiles, $tscPID, array $additionalData = NULL) {
$PP = array($table, $id, $curValue, $status, $realPid, $recFID, $tscPID);
switch ($tcaFieldConf['type']) {
case 'text':
$res = $this->checkValue_group_select($res, $value, $tcaFieldConf, $PP, $uploadedFiles, $field);
break;
case 'inline':
- $res = $this->checkValue_inline($res, $value, $tcaFieldConf, $PP, $field);
+ $res = $this->checkValue_inline($res, $value, $tcaFieldConf, $PP, $field, $additionalData);
break;
case 'flex':
// FlexForms are only allowed for real fields.
*/
public function checkValue_flex($res, $value, $tcaFieldConf, $PP, $uploadedFiles, $field) {
list($table, $id, $curValue, $status, $realPid, $recFID) = $PP;
+
if (is_array($value)) {
// This value is necessary for flex form processing to happen on flexform fields in page records when they are copied.
// The problem is, that when copying a page, flexfrom XML comes along in the array for the new record - but since $this->checkValue_currentRecord does not have a uid or pid for that sake, the t3lib_BEfunc::getFlexFormDS() function returns no good DS. For new records we do know the expected PID so therefore we send that with this special parameter. Only active when larger than zero.
// Passthrough...:
$res['value'] = $value;
}
+
return $res;
}
* @param array $tcaFieldConf Field configuration from TCA
* @param array $PP Additional parameters in a numeric array: $table,$id,$curValue,$status,$realPid,$recFID
* @param string $field Field name
+ * @param array $additionalData Additional data to be forwarded to sub-processors
* @return array Modified $res array
* @todo Define visibility
*/
- public function checkValue_inline($res, $value, $tcaFieldConf, $PP, $field) {
+ public function checkValue_inline($res, $value, $tcaFieldConf, $PP, $field, array $additionalData = NULL) {
list($table, $id, $curValue, $status, $realPid, $recFID) = $PP;
if (!$tcaFieldConf['foreign_table']) {
// Fatal error, inline fields should always have a foreign_table defined
$this->addNewValuesToRemapStackChildIds($valueArray);
$this->remapStack[] = array(
'func' => 'checkValue_inline_processDBdata',
- 'args' => array($valueArray, $tcaFieldConf, $id, $status, $table, $field),
+ 'args' => array($valueArray, $tcaFieldConf, $id, $status, $table, $field, $additionalData),
'pos' => array('valueArray' => 0, 'tcaFieldConf' => 1, 'id' => 2, 'table' => 4),
- 'field' => $field
+ 'additionalData' => $additionalData,
+ 'field' => $field,
);
unset($res['value']);
} elseif ($value || \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($id)) {
- $res['value'] = $this->checkValue_inline_processDBdata($valueArray, $tcaFieldConf, $id, $status, $table, $field);
+ $res['value'] = $this->checkValue_inline_processDBdata($valueArray, $tcaFieldConf, $id, $status, $table, $field, $additionalData);
}
return $res;
}
} else {
// Default
list($CVtable, $CVid, $CVcurValue, $CVstatus, $CVrealPid, $CVrecFID, $CVtscPID) = $pParams;
- $res = $this->checkValue_SW(array(), $dataValues[$key][$vKey], $dsConf['TCEforms']['config'], $CVtable, $CVid, $dataValues_current[$key][$vKey], $CVstatus, $CVrealPid, $CVrecFID, '', $uploadedFiles[$key][$vKey], array(), $CVtscPID);
+
+ $additionalData = array(
+ 'flexFormId' => $CVrecFID,
+ 'flexFormPath' => trim(rtrim($structurePath, '/') . '/' . $key . '/' . $vKey, '/'),
+ );
+
+ $res = $this->checkValue_SW(array(), $dataValues[$key][$vKey], $dsConf['TCEforms']['config'], $CVtable, $CVid, $dataValues_current[$key][$vKey], $CVstatus, $CVrealPid, $CVrecFID, '', $uploadedFiles[$key][$vKey], $CVtscPID, $additionalData);
// Look for RTE transformation of field:
if ($dataValues[$key]['_TRANSFORM_' . $vKey] == 'RTE' && !$this->dontProcessTransformations) {
// Unsetting trigger field - we absolutely don't want that into the data storage!
* @param string $status Status string ('update' or 'new')
* @param string $table Table name, needs to be passed to t3lib_loadDBGroup
* @param string $field The current field the values are modified for
+ * @param array $additionalData Additional data to be forwarded to sub-processors
* @return string Modified values
*/
- protected function checkValue_inline_processDBdata($valueArray, $tcaFieldConf, $id, $status, $table, $field) {
+ protected function checkValue_inline_processDBdata($valueArray, $tcaFieldConf, $id, $status, $table, $field, array $additionalData = NULL) {
$newValue = '';
$foreignTable = $tcaFieldConf['foreign_table'];
$valueArray = $this->applyFiltersToValues($tcaFieldConf, $valueArray);
$parentRecord = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordWSOL($table, $id);
$language = intval($parentRecord[$GLOBALS['TCA'][$table]['ctrl']['languageField']]);
$transOrigPointer = intval($parentRecord[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']]);
+ $transOrigTable = \TYPO3\CMS\Backend\Utility\BackendUtility::getOriginalTranslationTable($table);
$childTransOrigPointerField = $GLOBALS['TCA'][$foreignTable]['ctrl']['transOrigPointerField'];
+
if ($parentRecord && is_array($parentRecord) && $language > 0 && $transOrigPointer) {
$inlineSubType = $this->getInlineFieldType($config);
- $transOrigRecord = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordWSOL($table, $transOrigPointer);
+ $transOrigRecord = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordWSOL($transOrigTable, $transOrigPointer);
+
if ($inlineSubType !== FALSE) {
$removeArray = array();
$mmTable = $inlineSubType == 'mm' && isset($config['MM']) && $config['MM'] ? $config['MM'] : '';
// Fetch children from original language parent:
/** @var $dbAnalysisOriginal \TYPO3\CMS\Core\Database\RelationHandler */
$dbAnalysisOriginal = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Database\\RelationHandler');
- $dbAnalysisOriginal->start($transOrigRecord[$field], $foreignTable, $mmTable, $transOrigRecord['uid'], $table, $config);
+ $dbAnalysisOriginal->start($transOrigRecord[$field], $foreignTable, $mmTable, $transOrigRecord['uid'], $transOrigTable, $config);
$elementsOriginal = array();
foreach ($dbAnalysisOriginal->itemArray as $item) {
$elementsOriginal[$item['id']] = $item;
public function processRemapStack() {
// Processes the remap stack:
if (is_array($this->remapStack)) {
+ $remapFlexForms = array();
+
foreach ($this->remapStack as $remapAction) {
// If no position index for the arguments was set, skip this remap action:
if (!is_array($remapAction['pos'])) {
$table = $remapAction['args'][$remapAction['pos']['table']];
$valueArray = $remapAction['args'][$remapAction['pos']['valueArray']];
$tcaFieldConf = $remapAction['args'][$remapAction['pos']['tcaFieldConf']];
+ $additionalData = $remapAction['additionalData'];
// The record is new and has one or more new ids (in case of versioning/workspaces):
if (strpos($id, 'NEW') !== FALSE) {
// Replace NEW...-ID with real uid:
$newValue = implode(',', $this->checkValue_checkMax($tcaFieldConf, $newValue));
}
// Update in database (list of children (csv) or number of relations (foreign_field)):
- $this->updateDB($table, $id, array($field => $newValue));
+ if (!empty($field)) {
+ $this->updateDB($table, $id, array($field => $newValue));
+ // Collect data to update FlexForms
+ } elseif (!empty($additionalData['flexFormId']) && !empty($additionalData['flexFormPath'])) {
+ $flexFormId = $additionalData['flexFormId'];
+ $flexFormPath = $additionalData['flexFormPath'];
+
+ if (!isset($remapFlexForms[$flexFormId])) {
+ $remapFlexForms[$flexFormId] = array();
+ }
+
+ $remapFlexForms[$flexFormId][$flexFormPath] = $newValue;
+ }
// Process waiting Hook: processDatamap_afterDatabaseOperations:
if (isset($this->remapStackRecords[$table][$rawId]['processDatamap_afterDatabaseOperations'])) {
$hookArgs = $this->remapStackRecords[$table][$rawId]['processDatamap_afterDatabaseOperations'];
}
}
}
+
+ if ($remapFlexForms) {
+ foreach ($remapFlexForms as $flexFormId => $modifications) {
+ $this->updateFlexFormData($flexFormId, $modifications);
+ }
+ }
}
// Processes the remap stack actions:
if ($this->remapStackActions) {
$this->remapStackRefIndex = array();
}
+ /**
+ * Updates FlexForm data.
+ *
+ * @param string $flexFormId, e.g. <table>:<uid>:<field>
+ * @param array $modifications Modifications with paths and values (e.g. 'sDEF/lDEV/field/vDEF' => 'TYPO3')
+ * @return void
+ */
+ protected function updateFlexFormData($flexFormId, array $modifications) {
+ list ($table, $uid, $field) = explode(':', $flexFormId, 3);
+ $record = $this->recordInfo($table, $uid, '*');
+
+ if (!$table || !$uid || !$field || !is_array($record)) {
+ return;
+ }
+
+ \TYPO3\CMS\Backend\Utility\BackendUtility::workspaceOL($table, $record);
+
+ // Get current data structure and value array:
+ $valueStructure = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($record[$field]);
+
+ // Do recursive processing of the XML data:
+ foreach ($modifications as $path => $value) {
+ $valueStructure['data'] = \TYPO3\CMS\Core\Utility\ArrayUtility::setValueByPath(
+ $valueStructure['data'], $path, $value
+ );
+ }
+
+ if (is_array($valueStructure['data'])) {
+ // The return value should be compiled back into XML
+ $values = array(
+ $field => $this->checkValue_flexArray2Xml($valueStructure, TRUE),
+ );
+
+ $this->updateDB($table, $uid, $values);
+ }
+ }
+
/**
* Triggers a remap action for a specific record.
*
throw new \RuntimeException('Internal ERROR: no permissions to check for non-admin user', 1270853920);
}
// For all tables: Check if record exists:
- if (is_array($GLOBALS['TCA'][$table]) && $id > 0 && ($this->isRecordInWebMount($table, $id) || $this->admin)) {
+ $isWebMountRestrictionIgnored = \TYPO3\CMS\Backend\Utility\BackendUtility::isWebMountRestrictionIgnored($table);
+ if (is_array($GLOBALS['TCA'][$table]) && $id > 0 && ($isWebMountRestrictionIgnored || $this->isRecordInWebMount($table, $id) || $this->admin)) {
if ($table != 'pages') {
// Find record without checking page:
$mres = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,pid', $table, 'uid=' . intval($id) . $this->deleteClause($table));
$mres = $this->doesRecordExist_pageLookUp($output['pid'], $perms);
$pageRec = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($mres);
// Return TRUE if either a page was found OR if the PID is zero AND the user is ADMIN (in which case the record is at root-level):
- if (is_array($pageRec) || !$output['pid'] && $this->admin) {
+ $isRootLevelRestrictionIgnored = \TYPO3\CMS\Backend\Utility\BackendUtility::isRootLevelRestrictionIgnored($table);
+ if (is_array($pageRec) || !$output['pid'] && ($isRootLevelRestrictionIgnored || $this->admin)) {
return TRUE;
}
}
*/
public function removeCacheFiles() {
\TYPO3\CMS\Core\Utility\GeneralUtility::logDeprecatedFunction();
- return \TYPO3\CMS\Core\Extension\ExtensionManager::removeCacheFiles();
+ return \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::removeCacheFiles();
}
/**
$TSConfig = $this->getTCEMAIN_TSconfig($tscPID);
if (!$TSConfig['clearCache_disable']) {
// If table is "pages":
- if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('cms')) {
+ if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('cms')) {
$list_cache = array();
if ($table === 'pages' || $table === 'pages_language_overlay') {
if ($table === 'pages_language_overlay') {
if ($this->admin || $this->BE_USER->getTSConfigVal('options.clearCache.all')) {
// Clear all caching framework caches
$GLOBALS['typo3CacheManager']->flushCaches();
- if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('cms')) {
+ if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('cms')) {
$GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('cache_treelist');
}
// Clearing additional cache tables:
}
}
}
- \TYPO3\CMS\Core\Extension\ExtensionManager::removeCacheFiles();
+ \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::removeCacheFiles();
break;
case 'temp_cached':
- \TYPO3\CMS\Core\Extension\ExtensionManager::removeCacheFiles();
+ \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::removeCacheFiles();
break;
}
$tagsToFlush = array();
// Clear cache for a page ID!
if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($cacheCmd)) {
- if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('cms')) {
+ if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('cms')) {
$list_cache = array($cacheCmd);
// Call pre-processing function for clearing of cache for page ids:
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearPageCacheEval'])) {
* @todo Define visibility
*/
public function internal_clearPageCache() {
- if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('cms')) {
+ if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('cms')) {
$GLOBALS['typo3CacheManager']->getCache('cache_pages')->flush();
}
}