Feature #63926
closed
$_EXTKEY is not set in Configuration/TCA php files
Added by Philipp Kerling almost 10 years ago.
Updated almost 10 years ago.
Description
Since TYPO3 6.1 it is possible and, in fact, recommended to define TCA in extensions in Configuration/TCA/...php files and overrides of existing tables in Configuration/TCA/Override/...php files instead of ext_tables.php. In ext_tables.php, the global variable $_EXTKEY (or $GLOBALS['_EXTKEY']) is always available as the extension key of the current extension. This simplifies some things such as forking existing extensions etc. since the name of the extension does not need to be spelled out every time.
Currently, the new TCA files do not provide this feature, i.e. $_EXTKEY is unset. For consistency and extension maintainability, I'd like to see it there, too.
- Status changed from New to Rejected
Hey.
No, $_EXTKEY is not set by the core by intention. In general we strive for a reduction of global and magic variable as much as possible.
So, if we're refactoring code towards new API's, we do not introduce stuff like new additional globals anymore.
Your extension knows its name anyway, please set it accordingly in your override files.
The code in Georgs news at this point is a clear "hack" and should go away, too. I guess Georg will take care.
This issue will be set to rejected now, sorry.
OK, but what's the rationale behind it? Is $_EXTKEY and $GLOBALS going to be deprecatd/removed in ext_tables.php, too?
If a global variable is bad, why not provide something else, e.g. a function that returns the current extension key? Sure my extension knows how it's named, but I think it shouldn't necessarily need to. In any case, having $_EXTKEY greatly reduced search/replace effort for FluidTYPO3 provider extensions I need to copy, rename and modify for different sites.
I've thought about it again, and reached the conclusion that I can understand the decision and it wouldn't add much value after all.
Thanks for the quick reply.
Also available in: Atom
PDF