简体   繁体   中英

Typo3 override backend classes

It's been a few weeks I work on Typo3 6.2 and I want to know how to override Typo3 Core classes .

In my case, I have to edit the way select html objects are displayed (I want to add optgroup but Typo doesn't allow us to do it). So I edited the file "FormEngine.php" (typo3/sysext/backend/Classes/Form) and now it works. But this isn't healthy for future upgrade.

Is there a way to override core classes like any other CMS would allow us to do ? And I haven't been able to find something on the Internet and I think it could be useful.

Thank you :)

  • Zisiztypo

Instead of modifying source code of CMS you can just declare a field with a user type and then point your custom userFunc

From the ref :

'tx_examples_special' => array (
        'exclude' => 0,
        'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:fe_users.tx_examples_special',
        'config' => array (
                'type' => 'user',
                'size' => '30',
                'userFunc' => 'Documentation\\Examples\\Userfuncs\\Tca->specialField',
                'parameters' => array(
                        'color' => 'blue'
                )
        )
),

TIP: Using this approach, you can create ANY type of field you need, it can be ie Google Maps selector, set of fields with common dependencies filled by JS, etc, etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM