Project

General

Profile

Actions

Feature #33045

closed

Enable TCA type field to depend on field of foreign table by syntax relationField:foreignTypeField

Added by Ingmar Schlecht over 12 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
Start date:
2012-01-08
Due date:
% Done:

100%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

Sometimes it would be useful to make a TCA type switch not directly based on a value of the current record, but based on a value of another table.

This is e.g. useful for IRRE when used with an intermediate table (making a relation to a third table). Sometimes it's useful to make the fields dependent on the type field of the third table.

Say you have a relation between "houses" and "building objects" and an "intermediate table" for making the relation and storing some properties on how exactly the building objects are used in that particular house. Now, depending on the "building object" that the user makes a relation to, the intermediate table should show different fields.

The patch (as pushed to gerrit) implements this.


Files

Actions #1

Updated by Gerrit Code Review over 12 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7706

Actions #2

Updated by Gerrit Code Review over 12 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7706

Actions #3

Updated by Gerrit Code Review about 12 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7706

Updated by Ingmar Schlecht about 12 years ago

How to test

Attached you can find an T3X extension and a T3D import/export of a page with some test records. If you change the relation field from the switch table to the other table (which has a normal type field) then you see how the order of the fields change (as defined in the type showItem definition in TCA).

Now, that one only tests the function in TCEForms. If you also want to test the t3lib_BEFunc function, modify (just for quick testing) the BE Web->List module's special field "_PATH" to contain the type field instead of a PATH for a while by changing those lines:

File: typo3/class.db_list_extra.inc

change those lines:

} elseif ($fCol == '_PATH_') {
$theData[$fCol]=$this->recPath($row['pid']);

to this:
} elseif ($fCol == '_PATH_') {
$theData[$fCol]=t3lib_BEfunc::getTCAtypeValue($table, $row);

And then go to the BE list module, go to detail view of the example table, check the special field "_PATH" to be displayed, which should now contain the type values (just for testing of course).

Actions #5

Updated by Gerrit Code Review about 12 years ago

Patch set 4 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7706

Actions #6

Updated by Ingmar Schlecht about 12 years ago

Attached is a new test extension which also tests it with a select field.

Actions #7

Updated by Gerrit Code Review about 12 years ago

Patch set 5 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7706

Actions #8

Updated by Ingmar Schlecht about 12 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #9

Updated by Riccardo De Contardi over 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF