Commit 49cfdfe8 authored by Guido Schmechel's avatar Guido Schmechel Committed by Markus Klein
Browse files

[BUGFIX] Use TSConfig defaults for DataHandler

Now the DataHandler observes the default values set in TsConfig. Example:

TCAdefaults.pages {
    # set page to visible
    hidden = 0
}

Resolves: #59383
Releases: master, 9.5
Change-Id: I51e5d07e4e9a9457135bb9af88868cd52af373d7
Reviewed-on: https://review.typo3.org/c/58453


Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
parent f6e27a1c
......@@ -516,11 +516,6 @@ class EditDocumentController
$tce->setControl($parsedBody['control'] ?? $queryParams['control'] ?? []);
// Set default values specific for the user
$TCAdefaultOverride = $beUser->getTSConfig()['TCAdefaults.'] ?? null;
if (is_array($TCAdefaultOverride)) {
$tce->setDefaultsFromUserTS($TCAdefaultOverride);
}
// Set internal vars
if (isset($beUser->uc['neverHideAtCopy']) && $beUser->uc['neverHideAtCopy']) {
$tce->neverHideAtCopy = 1;
......
......@@ -181,12 +181,6 @@ class NewMultiplePagesController
if (!empty($commandArray)) {
$pagesCreated = true;
$dataHandler = GeneralUtility::makeInstance(DataHandler::class);
// Set default TCA values specific for the user
$backendUser = $this->getBackendUser();
$tcaDefaultOverride = $backendUser->getTSConfig()['TCAdefaults.'] ?? null;
if (is_array($tcaDefaultOverride)) {
$dataHandler->setDefaultsFromUserTS($tcaDefaultOverride);
}
$dataHandler->start($commandArray, []);
$dataHandler->process_datamap();
BackendUtility::setUpdateSignal('updatePageTree');
......
......@@ -197,10 +197,6 @@ class SimpleDataHandlerController
if ($beUser->uc['neverHideAtCopy']) {
$this->tce->neverHideAtCopy = 1;
}
$TCAdefaultOverride = $beUser->getTSConfig()['TCAdefaults.'] ?? null;
if (is_array($TCAdefaultOverride)) {
$this->tce->setDefaultsFromUserTS($TCAdefaultOverride);
}
// Reverse order.
if ($this->flags['reverseOrder']) {
$this->tce->reverseOrder = 1;
......
......@@ -645,6 +645,13 @@ class DataHandler implements LoggerAwareInterface
if ($this->BE_USER->uc['recursiveDelete']) {
$this->deleteTree = 1;
}
// Get default values from user TSConfig
$tcaDefaultOverride = $this->BE_USER->getTSConfig()['TCAdefaults.'] ?? null;
if (is_array($tcaDefaultOverride)) {
$this->setDefaultsFromUserTS($tcaDefaultOverride);
}
// Initializing default permissions for pages
$defaultPermissions = $GLOBALS['TYPO3_CONF_VARS']['BE']['defaultPermissions'];
if (isset($defaultPermissions['user'])) {
......@@ -878,7 +885,7 @@ class DataHandler implements LoggerAwareInterface
$old_pid_value = '';
// Is it a new record? (Then Id is a string)
if (!MathUtility::canBeInterpretedAsInteger($id)) {
// Get a fieldArray with default values
// Get a fieldArray with tca default values
$fieldArray = $this->newFieldArray($table);
// A pid must be set for new records.
if (isset($incomingFieldArray['pid'])) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment