Bug #16270
closedMultilanguage Flexforms don't work after migrating a site from one language to more languages
0%
Description
Symptom:
After adding a new language to an existing TV-Site with FCE-Elements the BE shows each field of FCE for each language (vDEF, vEN and so on). After saving the FCE the first time you only see a language called "vA" and see the default language in read only mode.
Trying to repair the xml of the FCE will destroy the XML completely. So you loose all your content.
To show all the fields of the FCE in every language I extended the existing datastructures as follows:
<meta type="array">
<langChildren type="integer">1</langChildren>
<langDisable type="integer">0</langDisable>
</meta>
The problem seems to be that till now the XML data of the FCEs doesn't contain a meta-section.
While parsing the old XML and converting it to an array the part ['meta'] is empty.
In class.t3lib_flexformtools.php in method traverseFlexFormXMLData (approx. line 140) you try to assign an array to this:
$editData['meta']['currentLangId'] = array();
But $editData['meta'] is not an array so the assignment does not create an subarray and all the language meta stuff is lost.
To fix this error you have to make $editData['meta'] an array before if it is not already:
if(!is_array($editData['meta'])) $editData['meta'] = array();
$editData['meta']['currentLangId'] = array();
There is another error in class.t3lib_tcemain.php in t3lib_tcemain::checkValue_flex():
The XML of the data of a FCE before saving is:
<T3FlexForms>
<data type="array">
<sDEF type="array">
<lDEF type="array">
<headline type="array">
<vDEF>Willkommen im Travel Charme Bernstein Prerow / Fischland-Darß</vDEF>
</headline>
</lDEF>
</sDEF>
</data>
<meta type="array">
<currentLangId type="array">
<numIndex index="0">DEF</numIndex>
</currentLangId>
</meta>
</T3FlexForms>
t3lib_tcemain::checkValue_flex() changes this XML to:
<T3FlexForms>
<data>
<sheet index="sDEF">
<language index="lDEF">
<field index="headline">
<value index="vDEF">Willkommen im Travel Charme Bernstein Prerow / Fischland-Darß</value>
<value index="vEN"></value>
<value index="vFR"></value>
<value index="vIT"></value>
</field>
</language>
</sheet>
</data>
<meta>
</meta>
</T3FlexForms>
The problem is the empty <meta>-Tag which leeds to display-errors with the language-Fields (displaying vA).
To fix this, you have to add the following line after 1546:
if(!is_array($currentValueArray['meta'])) unset($currentValueArray['meta']);
This patch is to avoid an empty meta-structure in the XML.
To display FCEs correctly which already have this empty meta-structure inside their xml structure, you have to fix class.t3lib_tceforms.php in Method getSingleField_typeFlex():
Before the line (approx. line 2063) with
$editData['meta']['currentLangId']=array();
you have to add the following line:
if(!is_array($editData['meta'])) $editData['meta'] = array();
(issue imported from #M3720)
No data to display