Project

General

Profile

Actions

Bug #15511

closed

loadTCA() in t3lib_div only loads original TCA file and ignores additional TCA from t3lib_extMgm

Added by Simon about 18 years ago. Updated over 12 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend API
Target version:
-
Start date:
2006-01-26
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.0
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

The loadTCA function in t3lib_div loads the TCA from the original dynamic conf file of the extension. It will not load the TCA for any configuration (i.e. additional fields) that has been added via t3lib_extMgm. Currently the only option is to fully load the entire TCA array via tslib_fe::includeTCA(). But this is not an ideal solution.
Due to this limitation extensions which rely on TCA in the frontend (for example tt_products) cannot be extended with additional fields (or rather tslib_fe::includeTCA() has to be invoked).
This is therefore a request to modify loadTCA so that it loads the entire tca for a given table (as opposed to just the original dynamicConfigFile).

(issue imported from #M2397)


Files

static_info_tables-2397.diff (1002 Bytes) static_info_tables-2397.diff Administrator Admin, 2009-01-07 09:07
Actions #1

Updated by Martin Kutschker about 18 years ago

This is in not possible. To load the complete TCA for one table you have to execute all ext_tables.php files which will in effect load the complete TCA.

Actions #2

Updated by Franz Holzinger about 18 years ago

However it should be possible to define a function
t3lib_div::loadTCAfile($filename);

which will load the TCA defined in the file.

With this function it would be possible to define a hook which will load only the files containing TCA definitions. This would be the solution so that the TCA additions made in a ext_tables.php file will be added without having to load the TCA of all possible tables.

Actions #3

Updated by Franz Holzinger about 18 years ago

See tx_fhlibrary_system in fh_library for a solution to this. This is code from Stanislas Rolland. An extension author can create hooks to load these TCA files.

/* mergeExtendingTCAs($ext_keys) *
  • In case you wrote an extension, that extends the table "$table", then
  • the TCA information for the additional fields will be merged with the
    "$table" TCA. *
  • @param array Extension TCA's that should be merged.
    */
    function mergeExtendingTCAs($ext_keys){
global $_EXTKEY, $TCA;
//Merge all ext_keys
if (is_array($ext_keys)) {
for($i = 0; $i < sizeof($ext_keys); $i++){
//Include the ext_table
$_EXTKEY = $ext_keys[$i]; // added by F.Rakow
include(t3lib_extMgm::extPath($ext_keys[$i]).'ext_tables.php');
}
}
}
Actions #4

Updated by Franz Koch almost 18 years ago

No core fix for this? What I don't get - the backend knows of all the tables in the TCA and the TCA get's cached - so why not simply load the cached TCA in a temp-Array, extract the desired table and return it?
Would this be a possibility?

Actions #5

Updated by Franz Holzinger over 17 years ago

See newslist Extension Coordination team.'Merging fhlibrary into tx_lib: pi_getSetupOrFFvalue'
This function shall soon come into
tx_div::loadTcaAdditions($ext_keys);

Actions #6

Updated by Franz Holzinger over 17 years ago

This has been put by Elmar Hinz into TER for tx_div now.

http://typo3.org/extensions/repository/view/div/0.0.5/info/class.tx_div.php/

Do you still want this for TYPO3 Core?

Actions #7

Updated by Franz Holzinger about 16 years ago

Maybe this solution would be fine:

There could be a database table or file based table in the EM (localconf.php). An extension could mark in its ext_emconf.php that it extends another extension.
Then in class class.tslib_content.php could be an include of the ext_tables.php of all those exensions, who extend the current extension just before it gets rendered in FE. So all necessary TCA would be available for the extension. The extension itself does not need to care about this.

Actions #8

Updated by Lukas Rüegg about 16 years ago

The solution to use a function to load any added TCA works OK, but it would be nicer not to have to think about doing that. Your suggestion to set a flag seems the best approach to me.
+1
Cheers,
Simon

Actions #9

Updated by Franz Holzinger over 15 years ago

A copy of this function has also been included into static_info_tables, because I did not find the time yet to write a more enhanced solution. A bug fix to this must be made however.

Actions #10

Updated by Christian Kuhn over 14 years ago

FYI: I was unable to find a RFC in core list and removed the "pending in core list" tag again.

Actions #11

Updated by Franz Holzinger over 14 years ago

It has been added to the TYPO3 Core List on the 11th October 2006. You probably did not load the older issues into your newsreader.

RFC: new function loadTcaAdditions in t3lib_div

This is a SVN patch request.

Type:
library enhancement

Branches:
4.x,trunk

User writes:
When someone writes an extension of an extension e.g. using XCLASS then
the extending TCA fields to the original table are not used. Someone
would have to call tslib_fe::includeTCA(); but this would include all
possible TCA files when only one additional was needed.

Solution:
Add a new function to t3lib_div which loads the extending TCA files
(ext_tables.php) of the extensions given as parameter array.
This code has been provided by Vikram Mandal.

Test:
This function has been used successfully within tt_products since many
months. It is needed for the next version 2.0.1 of static_info_tables
and its translation extensions which I want to upload asap.
(http://fholzinger.com/index.php?id=170)

See also:

developer list:
RFC: sql where clauses in API for static_info_tables

extension coordination list:
mergeExtendingTCAs

tt_products list:
Problem extending tt_products

extension tx_div:
latest version

Greets,

Franz

See also this discussion on the Developer List:

http://www.nabble.com/Is-the-description-of-tslib_fe::includeTCA-wrong--td19344182.html

Actions #12

Updated by Christian Kuhn over 14 years ago

Thanks Franz. Must have missed that one, sorry.

Actions #13

Updated by Ferdinand Kuhl over 13 years ago

In the actual 4.4.x series this problem got reintroduced, as far as my tests show.

I stumbled upon installing mm_forum and the not working frontend-avatar upload. The max-filesize is read from TCA. But after calling
t3lib_div::loadTCA('fe_users');

the additional field does not appear.

Actions #14

Updated by Andreas Wolf over 12 years ago

  • Category changed from Communication to Backend API
  • Status changed from New to Closed
  • Target version deleted (0)
  • TYPO3 Version changed from 3.8.1 to 4.0
  • PHP Version deleted (4)

I can't really see an issue here - when adding fields to TCA via t3lib_extMgm::addTCAcolumns(), the TCA is loaded anyways. If you add new fields in files that are always loaded, like ext_localconf.php, this should work. If you use other files which are not included by TYPO3 automatically, you have a problem anyways...

A possible solution would be to include a mechanism to register additional fields without loading the full TCA; but that would require quite some work in t3lib_extMgm and would also be error-prone when it comes to adding these fields to the various types etc.

As this issue does not include a patch and what I described is more a feature and not a bug, I'm closing it. Feel free to open a feature request, or reopen if there's any bug I missed.

Actions #15

Updated by Franz Holzinger over 12 years ago

@Andreas Otto † Wolf:

Why do you write that addTCAcolumns should be included into the file ext_localconf.php? Shouldn't the calls addTCAcolumns come into the file ext_tables.php? As I understand the file ext_tables.php is the one which should deal with the changes of TYPO3 tables.

Actions

Also available in: Atom PDF