[TYPO3-dev] Record-Localisation and type-field

Benno Weinzierl benno_weinzierl at web.de
Fri Mar 7 00:50:55 CET 2008


Hi Masi,

i got excited and did a small patch tonight to solve this issue.
It's just a proof of concept as it does not handle all possible cases but it 
works for me.
Maybe it is possible for someone to review this and integrate a improved 
version of it in the core. What is the procedure for this?

I chnaged the Method getRTypeNum() in t3lib_tceforms.php like this:

function getRTypeNum($table,$row) {
 global $TCA;
  // If there is a "type" field configured...
 if ($TCA[$table]['ctrl']['type']) {
  $typeFieldName = $TCA[$table]['ctrl']['type'];
  $typeNum=$row[$typeFieldName]; // Get value of the row from the record 
which contains the type value.

  // -- Start Patch by Benno - does not work for overlay-tables and 
different l10n_modes so far
  if($TCA[$table]['columns'][$typeFieldName]['l10n_mode'] == 'exclude') {
   $lang = $row[$TCA[$table]['ctrl']['languageField']];
   $origUid = $row[$TCA[$table]['ctrl']['transOrigPointerField']];
   if($lang > 0 && $origUid > 0) {
    // fetch default-language record to get the typeNum
    $origLangRecord = t3lib_BEfunc::getRecord($table,$origUid);
    $typeNum = $origLangRecord[$typeFieldName];
   }
  }
  // -- End Patch

  if (!strcmp($typeNum,'')) $typeNum=0;   // If that value is an empty 
string, set it to "0" (zero)
 } else {
  $typeNum = 0; // If no "type" field, then set to "0" (zero)
 }

 $typeNum = (string)$typeNum;  // Force to string. Necessary for eg '-1' to 
be recognized as a type value.
 if (!$TCA[$table]['types'][$typeNum]) { // However, if the type "0" is not 
found in the "types" array, then default to "1" (for historical reasons)
  $typeNum = 1;
 }

 return $typeNum;
}


"Martin Kutschker" <Martin.Kutschker at n0spam-blackbox.net> schrieb im 
Newsbeitrag news:mailman.1.1204799323.9830.typo3-dev at lists.netfielders.de...
> Benno Weinzierl schrieb:
>> Hi Steffen,
>>
>> i am using a select-field at the moment. Everything is working like a 
>> localized tt_content.
>> But that is not the desired behaviour.
>> With tt_content it is possible to localize a Textelement and switch to 
>> (for example) Image in the localized version (while the default-record 
>> stays text).
>> This is not what i want for my teaser-extension. I want to prevent this. 
>> The User should decide the type of the teaser only in the 
>> default-language-record.
>
> As you have written this is not really possible right now. There was a 
> discussion in the last few month. IIRC we talked about the necessary 
> changes * in TCEform but nothing has been done.
>
> Maybe you can dig it up.
>
> Masi
>
> * The ideas was to load the type field from the original translation 
> record before showing the form. 






More information about the TYPO3-dev mailing list