Feature #33045

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

Added by Ingmar Schlecht about 9 years ago. Updated about 3 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

#1

Updated by Gerrit Code Review about 9 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

#2

Updated by Gerrit Code Review about 9 years ago

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

#3

Updated by Gerrit Code Review almost 9 years ago

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

#4

Updated by Ingmar Schlecht almost 9 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).

#5

Updated by Gerrit Code Review almost 9 years ago

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

#6

Updated by Ingmar Schlecht almost 9 years ago

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

#7

Updated by Gerrit Code Review almost 9 years ago

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

#8

Updated by Ingmar Schlecht almost 9 years ago

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

Updated by Riccardo De Contardi about 3 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF