1

I am new to Typo3, I'm using version 6.0. I have made a custom extension extending from News 2.1, and I made some custom fields and created a new type of news called "Activity". What I want to do is that when you choose "Activity" from the select type, the form reloads with the custom fields I want.

In other words, I want to reproduce what happens when you change the type of new from "News" to "Internal page" for example, but with the fields I want like in this : (in ext_tables.php)

$tmp_activite_columns = array(

'act_field1' => array(
    'exclude' => 0,
    'label' => 'LLL:EXT:myExt/Resources/Private/Language/locallang_db.xlf:myExt.act_field1',
    'config' => array(
        'type' => 'input',
        'size' => 30,
        'eval' => 'trim'
    ),
),
'act_axe' => array(
    'exclude' => 0,
    'label' => 'LLL:EXT:myExt/Resources/Private/Language/locallang_db.xlf:myExt.act_axe',
    'config' => array(
        'type' => 'input',
        'size' => 30,
        'eval' => 'trim'
    ),
),
);

How can I use $tmp_activite_columns so the form loads with these fields ?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
user2179985
  • 75
  • 3
  • 10

1 Answers1

4

You have to add this columns permanently to your TCA. Via TCA, you can then define a displayCond (display condition) to fields you only want to display, if another field has a certain value.

I assume your form already reloads when you choose the type, so here is an example for the displayCond in the TCA:

'act_field1' => array(
  'displayCond' => 'FIELD:type:=:3',
  'exclude' => 0,
  'label' => 'LLL:EXT:myExt/Resources/Private/Language/locallang_db.xlf:myExt.act_field1',
  'config' => array(
    'type' => 'input',
    'size' => 30,
    'eval' => 'trim'
   ),
),

So basically you check if the field "type" has the value "3" for example. You can find more information about displayCond in the TCA Documentation.

Shufla
  • 872
  • 4
  • 10