Reputation: 527
TYPO3 9, but is probably independent of TYPO3 version
I have installed news
and eventnews
. eventnews
adds a field location_simple
to the table tx_news_domain_model_news
. In the backend this is of type input
. I want it to be of type text
. Therefore I added a file Configuration/TCA/Overrides/tx_news_domain_model_news.php
to my sitepackage:
<?php
if( !defined('TYPO3_MODE') ) {
die ('Access denied.');
}
// Modify location simple
$GLOBALS['TCA']['tx_news_domain_model_news']['columns']['location_simple']['config']['type'] = 'text';
But this has no effect.
My sitepackage is included at last position, so it should be able to overwrite the TCA of eventnews
. What is correct the magic for this?
Upvotes: 2
Views: 1949
Reputation: 998
You must add the extension 'news' to the dependencies of your extension. Then this will have the effect that the TCA of extension 'news' is included before your extension's TCA code is executed.
file ext_emconf.php:
$EM_CONF[$_EXTKEY] = [
...
'constraints' =>
[
'depends' =>
[
'typo3' => '11.5.0-12.4.99',
'php' => '7.4.0-8.2.99',
'news' => '9.3.0-11.2.99',
],
],
);
file composer.json:
"require": {
"typo3/cms-core": "^11.5 || ^12.4",
"php": "^7.4 || ^8",
"news": "^9.3 || ^10 || ^11"
},
From the docs:
"If your extension modifies another extension, you actively need to make sure your extension is loaded after the extension you are modifying. This can be achieved by registering that other extension as a dependency (or suggestion) of yours."
Upvotes: 0
Reputation: 527
This worked for me: rename my site package extension so that it has an extension key alphabetically after 'e'.
It seems as if the files in /Configuration/TCA/Overrides are read alphabetically. In my case I wanted to override eventnews
. So my site package extension key had to begin with a letter in [f-z].
Upvotes: 1