[TYPO3-core] Another issue with multiple category selectors

Peter Niederlag peter.niederlag at typo3.org
Fri Oct 4 10:22:27 CEST 2013


Hi Francois,

On 03.10.2013 22:42, François Suter wrote:
> Hi all,
> 
> I just came across another issue related to the recent new feature of
> being able to add several category selectors to the same table. The
> default name for such a category selector is "categories". Now if you
> add another such field and name it like "tx_myextension_categories", it
> will override "categories" because of the way
> \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes()
> behaves.

Took me quite some time to reproduce. ;)

$newCategoryFine = 'c2ategories'; // you are fine
$newCategoryBroken = 'categories2'; // broken

This is due to the internal working of addToAllTCAtypes() and it's usage
of strpos() on testing of the existance of the fieldname.

> What do you think?

IMHO this really seems to be a general problem/issue with
addToAllTCAtypes() that migth be worth fixing.

If you add a fieldname that fully matches any part of an existing
fieldname you are likely to run into problems.

'great_feature_field'
you can't add any field with names like 'great', 'feature' or 'field'.

Fixing it by renaming the default categories field to
'default_categories' would be a quick and easy workaround that leaves us
with a "terrible" field name. I'd like to see it fixed in another way.

Greets,
Peter


More information about the TYPO3-team-core mailing list