[TYPO3-core] RFC #16096 Bug: addToAllTCATypes after certain fields does not work anymore

JoH asenau info at cybercraft.de
Thu Dec 16 12:38:19 CET 2010


> $TCA['tt_content']['types']['image']['showitem'] = str_replace(',
> image;', ', tx_damttcontent_files;',
> $TCA['tt_content']['types']['image']['showitem']);
> 
> Is there any chance to get this hacky str_replace work?

Frankly said: No chance!

The reasons are, that there is
a) no field named "image" in the "showitem" section anymore, since it has been moved to a palette containing other image stuff as well
b) the str_replace approach was just working in certain scenarios, like with DAM, when a field replaces another one keeping the same settings after the ";" and expecting exactly the default settings as defined by the core.

str_replace would fail for any scenario containing a different setting for the image field introduced by another extension or plain extTables.php, i.e. things like these

* Plain field without additional settings
['showitem'] = header, image, text

* Image field at the beginning of the string
['showitem'] = image;blah;something;else, header, text

* No space after the comma
['showitem'] = header,image;blah;something;else,text

would fail as well. 

So the bug is in the way things are handled by DAM and other extensions using str_replace, where a preg_replace or an even more sophisticated approach would have been more appropriate.

Since the DAM code shows that it has always been adapted to new TYPO3 versions, I guess it will be no big deal to fix it once again, after all it should be the last time someone has to do it ;-)

HTH

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your gob sometimes!)
Dieter Nuhr, German comedian
Xing: http://contact.cybercraft.de
Twitter: http://twitter.com/bunnyfield
TYPO3 cookbook (2nd edition): http://www.typo3experts.com


More information about the TYPO3-team-core mailing list