Bug #76979
closedFormEngine should allow to set default-Values in new CType-Elements
0%
Description
Create a new content-Element as Extension myext with ctype=myctype
In typo3conf/ext/myext/Configuration/TCA/Overrides/tt_content.php you can choose the Form-Elements being shown with CE "myctype" by setting
$GLOBALS['TCA']['tt_content']['types']['myctype']['showitem'] to the
Changing the behaviour of single form elements is only partly possible:
$GLOBALS['TCA']['tt_content']['types']['myctype'] = [
'columnsOverrides' => [
'imageheight' => [
'config' => [
'default' => 250,
'max' => 6,
]
],
Here, "max" will have an effect when using the field in BE, "default" will have no effect
Updated by Christian Kuhn over 8 years ago
Hey, thanks for report.
that's a chicken egg problem: for new records, type is not defined yet, so columnsOverrides can't be used, so you can't set default values in columnsOverrides.
Will close as rejected if you don't have a great idea on how do solve that without hacks.
btw: you could hand over the ctype as get or post (the new content element wizard does stuff like that). in this case the columnsOverrides will work if i remember correctly.
Updated by Christian Kuhn over 8 years ago
- Status changed from New to Needs Feedback
Updated by Nicolai Schirawski over 8 years ago
But strange: the max value can be changed with columnsOverrides. So this part works
And I am overwriting existing fields in tt_content...
So I think overwriting default should work, too.
Updated by Alexander Opitz about 8 years ago
- Subject changed from FromEngine should allow to set default-Values in new CType-Elements to FormEngine should allow to set default-Values in new CType-Elements
- Status changed from Needs Feedback to New
@Christian Kuhn: There was an answer for you.
Updated by Felix Nagel over 7 years ago
Confirmed for TYPO3 8.7.3
that's a chicken egg problem: for new records, type is not defined yet, so columnsOverrides can't be used, so you can't set default values in columnsOverrides.
This works for eval, placeholder, etc. before saving the new element.
Updated by Christian Kuhn about 6 years ago
- Status changed from New to Rejected
Hey. I'll have to close this. 'default' is set before type is calculated (because type can be influenced by default). So there really is a chicken-egg problem and setting 'default' in columnsOverride will not work in the forseable future.