Storing the changes

There are various ways to store changes to $GLOBALS['TCA']. They depend - partly - on what you are trying to achieve and - a lot - on the version of TYPO3 CMS which you are targeting.

Important

Be aware that $TCA is not available in all contexts. It is advised to always use $GLOBALS['TCA'] instead.

There are two main ways to store your changes to the TCA: inside an extension or straight in the typo3conf folder. Both are described below in more details.

Storing in extensions

The advantage of putting your changes inside an extension is that they are nicely packaged in a self-contained entity which can be easily deployed on multiple servers.

The drawback is that the extension loading order must be finely controlled. Indeed if your extension modifies another extension, your extension must be loaded after the extension you are modifying. This can be achieved by registering that other extension as a dependency of yours. See the description of constraints in Core APIs.

Note

This works particularly well since TYPO3 CMS 6.2, which comes with a rewritten dependency resolver.

Before TYPO3 CMS 6.0, it is also possible to use the the "priority" property in the ext_emconf.php file can help (a "bottom" extension will load last, but its exact loading order may vary if there are several "bottom"-priority extensions).

For more information about an extension's structure, please refer to the extension architecture chapter in Core APIs.

Storing in ext_tables files

Until TYPO3 CMS 6.1 (still supported for 6.2) changes to $GLOBALS['TCA'] are packaged into an extension's ext_tables.php file.

Storing in the Overrides folder

Since TYPO3 CMS 6.2 (6.2.1 to be precise) changes to $GLOBALS['TCA'] should be stored inside a folder called Configuration/TCA/Overrides.

A best practice consists of creating in that directory one file per modified table. The file is named along the pattern: "tablename.php".

The advantage of this method is that all such changes are incorporated into $GLOBALS['TCA'] before it is cached. This is thus far more efficient.

Storing in typo3conf folder

Note

The information below is relevant only for versions of TYPO3 CMS older than 6.2.

Changes can also be written to a general file in the typo3conf directory. The name of this file is defined by the configuration variable $GLOBALS['TYPO3_CONF_VARS']['DB']['extTablesDefinitionScript']. The name extTables.php is most generally used.

The advantage of using the "extTablesDefinitionScript" file is that it is loaded last. This means that you are sure that your changes are not overridden by some other customizations. Also editing $GLOBALS['TCA'] from the Admin Tools > Configuration module will only work if such a file is defined (and writable, of course).

It's perfectly possible to work without that file by not defining it at all or unsetting existing definitions. Usage of that file is deprecated since TYPO3 CMS 6.2. Use the "extension method" described above instead.

Changing the TCA "on the fly"

It is also possible to perform some special manipulations on $GLOBALS['TCA'] right before it is stored into cache, thanks to the tcaIsBeingBuilt signal. This signal was introduced in TYPO3 CMS 6.2.1.