[TYPO3-dev] Is the description of tslib_fe::includeTCA wrong?
Franz Holzinger
franz at fholzinger.com
Sat Sep 6 15:19:39 CEST 2008
Dmitry Dulepov [typo3] a écrit :
> Hi!
>
> I just noticed that description of this function says:
> ====================
> Includes full TCA.
> Normally in the frontend only a part of the global $TCA array is loaded,
> for instance the "ctrl" part. Thus it doesn't take up too much memory.
> If you need the FULL TCA available for some reason (like plugins using
> it) you should call this function which will include the FULL TCA.
> Global vars $TCA, $PAGES_TYPES, $LANG_GENERAL_LABELS can/will be affected.
> The flag $this->TCAloaded will make sure that such an inclusion happens
> only once since; If $this->TCAloaded is set, nothing is included.
> ====================
>
> It appears that this description is historical and does not describe
> what the function does now. Here is what it actually does:
> ====================
> if (!$this->TCAloaded) {
> $TCA = Array();
> include (TYPO3_tables_script ? PATH_typo3conf.TYPO3_tables_script :
> PATH_t3lib.'stddb/tables.php');
> // Extension additions
> if ($GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE']) {
>
> include(PATH_typo3conf.$GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE'].'_ext_tables.php');
>
> } else {
> include(PATH_t3lib.'stddb/load_ext_tables.php');
> }
> // ext-script
> if (TYPO3_extTableDef_script) {
> include (PATH_typo3conf.TYPO3_extTableDef_script);
> }
> $this->TCAloaded = $TCAloaded;
> }
> ====================
>
> So, it only loads ext_tables.php from each extension and does not load
> dynamic configuration file (tca.php).
>
> Can anyone confirm that I am not blind and the description is wrong? If
> yes, I will change it to reflect the real life.
>
Have a look at the method getCompressedTCarray where the description is
better:
Get the compressed $TCA array for use in the front-end
A compressed $TCA array holds only the ctrl- and feInterface-part for
each table. But the column-definitions are omitted in order to save some
memory and be more efficient.
Operates on the global variable, $TCA
function getCompressedTCarray() {
...
foreach($TCA as $key => $val) {
$newTc[$key]['ctrl'] = $val['ctrl'];
$newTc[$key]['feInterface'] = $val['feInterface'];
// Collect information about localization exclusion of fields:
t3lib_div::loadTCA($key);
if (is_array($TCA[$key]['columns'])) {
$this->TCAcachedExtras[$key]['l10n_mode'] = array();
foreach($TCA[$key]['columns'] as $fN => $fV) {
if ($fV['l10n_mode']) {
$this->TCAcachedExtras[$key]['l10n_mode'][$fN] = $fV['l10n_mode'];
}
}
}
}
This function will load the TCA.
t3lib_div::loadTCA fetches the $tca['ctrl']['dynamicConfigFile'] where
the tca.php files has to be stored. Then the tca.php will be loaded
inside of this function.
More information about the TYPO3-dev
mailing list