Bug #16476
closed
TCAdefaults.table.field doesn't work for MM-fields
Added by Marc Bastian Heinrichs over 18 years ago.
Updated about 16 years ago.
Description
A new record can't have an mm-record, because it has no uid. So the default value for an mm-field is killed by class.t3lib_transferdata.php. There should be a check for new records to hand over the default value to t3lib_TCEforms.
(issue imported from #M4060)
Files
Please provide some more details. Which field do you want to override by TCAdefaults? MM-tables are not defined in TCA, so this might not work at all.
But, please just give an example. Thanks!
For example tt_news:
You cann't set a default category by TS with
TCAdefaults.tt_news.category = 2
because the relation to tt_news_cat is an mm-relation and the proceeding in t3lib_loaddbgroup.php or class.t3lib_transferdata.php kill the default value cause there is no uid for an new tt_news-record yet .
With fix in 4022 it works correct.
Ah thanks, now I got it. It could also be possible, that a list of UIDs will be defined (e.g. "2,5,1"). The readList in extracts these values and holds them for later writing with writeMM. It could also happen that different tables are affected, like "tt_news:2,tt_content:13,..."
I'll take a closer look at t3lib_loadDBgroup.
Thanks.
I had a look on it and I think the check dropping the default value was in class.t3lib_transferdata.php, but it's some time ago.
The attached patch fixes this problem ...
Has to get applied against 4.1.2 ... do not know if it works well for other versions.
greets,
Bernhard
Thanks Bernhard!
Seems to work for me on trunk but I haven't tested extensively enough to see if there are any side effects yet. I'm attaching an updated patch that applies cleanly to trunk. No functional changes from the original though.
I attached a unified diff for 4.1.2
Could you post your experiences to the core-list after checking possible side effects ?
Subject of my patch request:
RFC: TCAdefaults for MM-Fields #16459, #16459
Any progress on this one?
Also available in: Atom
PDF