[TYPO3-dev] solved: about using ['columns'][field name]['config'] / TYPE: "user"

Ivano Luberti luberti at archicoop.it
Sun Feb 24 18:30:27 CET 2013


Hi, clearly the problem was in a not proper instantiation of the 
TCEForms object. It seemed to me really cumbersome that a developer 
would be forced to know every detail and so I digged more in the code, 
only to realize that the $fobj passed by TYPO3 to my custom funcition is 
a reference to the TCEforms currently executing.

Using that instead of my own instance solved the problem.

Hope this can help other developers

------------------------

Hi, I'm trying to use the possibility to customize a field in the 
backend using the 'user' type field of the  TCA as specified in the 
['columns'][field name]['config'] / TYPE: "user" of TCA manual.
I have wrote a funcion and specified it in the TCA.

What I'm trying to achieve is quite simple: based on a certain condition 
I want to display either a textarea or an input field..

So I have written this function:


        $tceforms = t3lib_div::makeInstance('t3lib_TCEforms');
         $tceforms->initDefaultBEMode(); ..
         $tceforms->disableWizards = 1;

         //removed code to get the $condition value

         if($condition){
             return $tceforms->getSingleField_typeText($PA['table'], 
$PA['field'], $PA['row'], &$PA);
         }else{
             return $tceforms->getSingleField_typeInput($PA['table'], 
$PA['field'], $PA['row'], &$PA);

         }


It doesn't work: the field is diplayed and it is the right type but 
there is no value in it.

To understand if tranlsating parameters I get in my function for 
adapting them to the TCEForms methods was causing something wrong I 
modified the getSingleField_SW in TCEForms method as follows:

             case 'user':
                  $item = $this->getSingleField_typeUser($table, $field, 
$row, $PA);
                  $item = $this->getSingleField_typeInput($table, 
$field, $row, $PA);


Now the $item value after each method execution seems to be identical 
(except for the uniqueid generated for the HTML control). But If I 
execute only my method the value is not showed in the control, while if 
I execute

$this->getSingleField_typeInput($table, $field, $row, $PA);

after my method or instead of my method everything works correclty.

I really cannot understand what I'm doing wrong.

I hope someone can point me in the right direction: thanks for your 
attention.








-- 
==================================================
dott. Ivano Mario Luberti
Archimede Informatica societa' cooperativa a r. l.
Sede Operativa
Via Gereschi 36 - 56126- Pisa
tel.: +39-050- 580959
tel/fax: +39-050-9711344
web: www.archicoop.it
==================================================




More information about the TYPO3-dev mailing list