0
votes

I want to override the label strings "Available Items" and "Selected Items" in a selectMultipleSideBySide form because it is too generic. I have multiple record types using this form template so I cannot change the strings globally.

I tried to change it in the TCA of my custom record type without success. I only see the label for the entire relation.

I am using TYPO3 8.7

Does anyone know an extension which accomplished this or does anyone know the config path to there?

Thanks!

Edit: In the class typo3/sysext/backend/Classes/Form/Element/SelectMultipleSideBySideElement.php at line 393 I found the translation path hard-coded. So I need to inherit from this class and register it as my new selectMultipleSideBySide in the TCA.

1

1 Answers

0
votes

I copied the class TYPO3.CMS/typo3/sysext/backend/Classes/Form/Element/SelectMultipleSideBySideElement.php to my extension in Classes/From/Element/SelectTagCloudElement.php

  1. I adapted namespace to my extensions.

  2. I add a use-directive of use TYPO3\CMS\Backend\Form\Element\SelectMultipleSideBySideElement;.

  3. I adapt the translation string like in line 221 to my custom records translation xml file.

  4. I found on https://docs.typo3.org/m/typo3/reference-coreapi/8.7/en-us/ApiOverview/FormEngine/Rendering/Index.html a snippet to register an new NodeType (the class I extended previously) using:

// Add new field type to NodeFactory
$GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'][1487112284] = [
    'nodeName' => 'selectTagCloud',
    'priority' => '70',
    'class' => \MyVendor\CoolTagCloud\Form\Element\SelectTagCloudElement::class,
];

in ext_localconf.php

  1. Now I can use selectTagCloud instead of selectMultipleSideBySide in the TCA.

  2. "Dump Autoload Information" in the Install Tool

Done