I've added a Flexform to the Textmedia Content Element. That works nicely. How can I get the Form data in the view? The content element has no controller and the {settings} variable does not contain Flexform data.
I'm happy for every help.
Cheers
You can simply convert a Flexform XML string to an array using TYPO3 Core API:
$ffContent = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($xmlString);
This will just convert the XML tag structure to an array, which leaves you with a pretty complex array to iterate.
To get a simplified structure without alle the Flexform "bloat" for sheets, localization etc., Extbase offers its own FlexformService:
$flexformService = GeneralUtility::makeInstance('TYPO3\CMS\Extbase\Service\FlexFormService');
$ffContent = $flexformService->convertFlexFormContentToArray($xmlString);
If you need content from a localization, you need to pass an adjusted value for either $languagePointer (the second parameter) or $valuePointer (the third one).
EDIT: As you wrote that you don’t have a controller at hand to put the code above into, you might want to create a view helper for that. The view helper could assign the result of the operation as a separate variable that you could access
{namespace me=MyVendor\MyExtension\ViewHelpers}
…
<me:decodeFlexform value="{object.pi_flexform}" as="ffValues">
{ffValues.myField}
</me:decodeFlexform>
Probably there is also already one in one of the various view helper collection extensions (vhs and friends) already.