Feature #50962
closedt3lib_flexformtools still missing simple method for reading FlexForm-Data
0%
Description
FlexForm's are used more and more in TYPO3. But as far as I know there's still missing core-method for simple data-retrival.
The Core-Class t3lib_flexformtools
has some methods for data traversing. But in my opinion this covers only one common need.
To simply retrieve the FlexForm-Data (saved FlexForm) as array, there don't seem to be any method yet. As currently every deveoper seems to cook his own soup on this, I think t3lib_flexformtools
would be the right way to implement something on this.
I would expect a method like this:
Method:
t3lib_flexformtools::flexData2xml( string $flexXML, # The FlexForm XML $singleField = null #(optional) bool $allLanguages = false, int $languageUid = 0 # (default is always the current sys_language_uid!) )
I would expect this result:
1. Using argument $allLanguages=true
f.e.
Array( // Array of Rows by LanguageKey 'lDEF' => Array( 'field_hello' => 'hello world', ), '1' => Array( 'field_hello' => 'hallo welt', ), );
2. Using argument $allLanguages=false
f.e.
(Say sys_language_uid is "1") Array( 'field_hello' => 'hallo welt', );
As first draft:
This method could be implemted upon t3lib_flexformtools::traverseFlexFormXMLData
which already exists for use with Callback-Functions.
Implementing a private function as reader for our flexData2xml
, this shouldn't be too much complicated.
If there is some positive feedback I would try to invest my time to provide a patch. Please give feedback or improvements or just post "please do" - to let me know if it is worth investing time for posting a patch here.
Updated by Gabriel Kaufmann / Typoworx NewMedia over 11 years ago
I just noticed that Extbase has one method doing nearly what I mentioned:
Class FlexFormService
"extbase/Classes/Service/FlexFormService"
Updated by Mathias Schreiber almost 10 years ago
- Target version set to 7.4 (Backend)
Updated by Susanne Moog over 9 years ago
- Target version changed from 7.4 (Backend) to 7.5
Updated by Benni Mack about 9 years ago
- Target version changed from 7.5 to 8 LTS
Updated by Christian Kuhn about 8 years ago
- Status changed from New to Closed
The language details were dropped from core in v7, they are still in both the data structure and the stored flex data, but rely on default "lDEF" and "vDEF" only.
One thing that is missing in the API of FlexFormTools is to get a single element or a group of elements by given path, the TCA tree, inline and suggest wizard would benefit from that. The details are not clear yet, though, and currently all three usages are all slightly different.
We'll add more helper methods to FlexFormTools as soon as they evolve and are more clear (we recently moved a big chunk of the data structure processing into that class already).
I think we should close this issue here for now since the language stuff isn't relevant anymore and the rest is not too clear.
Please feel free to open a new issue for a specific need, otherwise we'll see how that evolves. Furthermore it is probably a good idea to review the extbase FlexFormService class and its usages and maybe move the remaining two methods over to FlexFormTools, too.