Max Garten Max Garten - 1 month ago 9
PHP Question

Typo3/TCA create new tab with fields of another tab inside

I need some help in Typo3/TCA.
Im trying to modify the backend layout of an extension, but cant get it to work.

I try to make the context of "Firma" as a new tab (see image).

Firma1

I fugured out that the context of "Firma" is defined in tca.php in

$TCA['tx_jobsystem_domain_model_job']
as column 'address'. (l. 328 ):

'address' => array(
'label' => $languageFile . ':tx_jobsystem_domain_model_job.address',
'config' => array(
'type' => 'inline',
'foreign_table' => 'tt_address',
#'foreign_field' => 'uid',
'symmetric_field' => 'address',
'appearance' => array(
'collapseAll' => true,
'expandSingle' => true
)

)
),


I did copy it to
$TCA['tx_jobsystem_domain_model_advertisement']
at line 116 and used it at l. 272, where the tabs are defined:

'0' => array('showitem' => 'hidden,id, ... visits,--div--;Anzeigendetails,title,job,--div--;Firma,address;;;richtext:nowrap;'),


This is what i get:

Firma2

Sourcecode: tca.php
www.pastebin.com/a9egZsqi

also ext_tables.php:
www.pastebin.com/rwGbW3qG

Can anyone help me ?

Answer

1) Comments to your basic setup:

The problem is, that you have three things here:

A) Advertisement

B) A job description (connected to the Advertisement)

C) A company (Firma) (connected to the job)

The relations are the following:

A)
---> B)
     ---> C)

So what you want to display C) in A) in a new tab.

Unfortunately, it would be only possible with a userFunc that handles selects the company of the job and returns as a field.

2) Comments to your change:

You have to change your data model like:

A)
---> B)
---> C)

You can not grab a "3rd level inline object" that is connected throught a "2nd level inline object" into the 1st level.

You second code is not working, because you do not have the connection between the company and the advertisement. For that you need to change your ext_tables.sql and domains and so on. But then you lost the connection between the job and the company.

Comments