New TCA types in TYPO3 version 11
Add special fields with ease
Just in time for the release of the new v12 update we would like to complete this series with our last recap of the TYPO3 v11 series. Stay tuned for all new features of upcoming updates.
In previous installments, we covered some of the great UX improvements that are making editors' lives easier.
In this final post of the series, we’ve got something special for all the developers and site administrators: new TCA types. Using these dedicated types will reduce and simplify the TCA configuration required for special fields. They also allow auto-configuration and auto-creation of database fields.
This post is part of our TYPO3 Version 11 Series. We’re shining a spotlight on some of the really useful features in version 11 and why you should upgrade.
- Link Sharing in TYPO3 v11
- Direct Downloads of Assets and Media
- New CLI commands and better automation for Continuous Integration
- Resizable Navigation Area in TYPO3
- Multi-factor authentication
- Search & Filter for Folders and Assets
- Limit allowed attempts for logins in TYPO3 v11
- Show Columns Selector in List View and File List View
- Multi Record Selection
- Keyboard Navigation for Module Menu & Context Menu
- Workspaces Improvements
- Consistent UX makes selecting items more intuitive
- New TCA types in TYPO3 version 11
What is a TCA type?
First, let’s clarify what a TCA type is. The table configuration array (TCA) contains the configuration for records, for example, pages or content. Each record usually contains a couple of fields. For example, the field to insert a record title would typically be a simple text field. To tell TYPO3 how to render this field, it has to be defined as TCA type `input`. This means, TCA types are used to tell TYPO3 how to render a field in the backend form. Additionally, TYPO3 uses TCA types internally when working with the field value, for example, when preparing the value for the database.
What are the benefits of the new TCA types?
While basic fields have stayed nearly the same over the years, a lot of special use-cases needed to be added, for example, the Link Browser for TCA type `input`. As more and more of these special cases were added, it got really hard to identify a field's purpose because the semantic meaning was not always clear at first sight. Additionally, the number of configuration options increased—options that weren’t always relevant for the majority of use-cases.
The newly introduced TCA types are now dedicated to only one special use-case, and they dramatically reduce the configuration options required for all types. Additionally, they allow further auto-configuration as well as auto-creation of database fields.
TCA type “category”
The new `category` type is used for rendering a category tree in the backend form and replaces the special configuration of the TCA type `select`. Using the new type allows it to finally replace the low-level CategoryRegistry, which had been used together with the “makeCategorizable” API.
Not only does having a dedicated type allow for much cleaner configuration, TYPO3 can now create the corresponding database field automatically, taking the specified relation type into account. And that’s not all. The relation type is now also considered. For example, when relation type “oneToOne” is specified, TYPO3 automatically defines the maximum number of categories to be selected.
While moving the category tree to its own type, it also got a technical overhaul and is now implemented as a web component, rendering much faster and running much smoother.
In summary, the configuration effort for rendering an improved category tree is significantly reduced and developers no longer need to define the corresponding database fields. Isn’t that great news?
TCA type “language”
TYPO3 wouldn’t be that successful without its strong support for multi-language installations. A common task is choosing the correct language for a record. This selection is now based on the new `language` type, which replaces the special “languages” option of TCA type `select`.
Besides the dedicated configuration, the new type finally allows for decoupling the site languages (introduced in TYPO3 v9) from the languages table, which had previously been used to define the available languages in a system. For editors, this means much faster loading of the field in the backend, since relations no longer have to be fetched or processed. For developers, this means reduction of a substantial amount of code and even more importantly: reduction of unnecessary complexity. We call this a win-win!
By the way, did you know about the special “all languages” option? This option can be used to tell TYPO3 to display a record in all languages. The new type now automatically provides this special option in the select box, so you no longer have to add it manually.
On-the-fly migration
Migrating all your TCA configurations to the new types might be time-consuming–especially for larger installations. It’s good to know that TYPO3 even supports you in this matter! An on-the-fly migration is done on every request, which means you don’t need to fix all your TCA types immediately–you can get to it when you find the time. Until then, TYPO3 will inform you exactly where adaptations need to take place in the general deprecation log.
More to come
We are very excited about the new types and we’re sure you are already convinced by the power of the new types, too. We have great news: TYPO3 v12 will add even more dedicated TCA types. So make sure you don’t miss the v12 series on our blog.
Have you already tried out the new types?
We are happy to help you migrate your TCA. Just get in touch.