Skip to content
Snippets Groups Projects
Commit 246e57d4 authored by Markus Klein's avatar Markus Klein Committed by Andreas Wolf
Browse files

[BUGFIX] Changing TCA via Tools->Configuration breaks TCA

Changing the TCA (especially the columns-part of a table) via
Tools->Configuration breaks eg. the list module.
Tools->Configuration writes strings like
$GLOBALS['TCA']['tt_news']['columns']['image']['config']['allowed'] = 'jpg';
to typo3conf/extTables.php.

However, a call to loadTCA($table) call is not added before, so
the TCA array is incomplete. Furthermore if you set the columns part
in extTables.php any proceeding call to loadTCA will not work, since
'columns' is already defined.

Change-Id: Ifc4103cdd04b6b063e3d099b5c5ccb47dfb7d442
Resolves: #M17754
Reviewed-on: http://review.typo3.org/1043


Reviewed-by: default avatarSteffen Gebert <steffen.gebert@typo3.org>
Tested-by: default avatarSteffen Gebert <steffen.gebert@typo3.org>
Reviewed-by: default avatarStefan Galinski <stefan.galinski@gmail.com>
Reviewed-by: default avatarSusanne Moog <typo3@susannemoog.de>
parent cde6deb1
Branches
Tags
No related merge requests found
......@@ -269,8 +269,22 @@ class SC_mod_tools_config_index {
$length = strpos($line, '[');
$var = substr($line, 0, $length);
$changedLine = '$GLOBALS[\'' . substr($line, 1, $length - 1) . '\']' . substr($line, $length);
// insert line in extTables.php
// load current extTables.php
$extTables = t3lib_div::getURL(PATH_typo3conf . TYPO3_extTableDef_script);
if ($var === '$TCA') {
// check if we are editing the TCA
preg_match_all('/\[\'([^\']+)\'\]/', $line, $parts);
if ($parts[1][1] !== 'ctrl') {
// anything else than ctrl section requires to load TCA
$loadTCA = 't3lib_div::loadTCA(\'' . $parts[1][0] . '\');';
if (strpos($extTables, $loadTCA) === FALSE) {
// check if the loadTCA statement is not already present in the file
$changedLine = $loadTCA . LF . $changedLine;
}
}
}
// insert line in extTables.php
$extTables = '<?php' . preg_replace('/<\?php|\?>/is', '', $extTables) . $changedLine . LF . '?>';
$success = t3lib_div::writeFile(PATH_typo3conf . TYPO3_extTableDef_script, $extTables);
if ($success) {
......@@ -278,7 +292,7 @@ class SC_mod_tools_config_index {
$flashMessage = t3lib_div::makeInstance(
't3lib_FlashMessage',
'',
sprintf($GLOBALS['LANG']->getLL('writeMessage', TRUE), TYPO3_extTableDef_script, '<br />', '<strong>' . $changedLine . '</strong>'),
sprintf($GLOBALS['LANG']->getLL('writeMessage', TRUE), TYPO3_extTableDef_script, '<br />', '<strong>' . nl2br($changedLine) . '</strong>'),
t3lib_FlashMessage::OK
);
} else {
......
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