tx_form breaks on custom label
I feel like this is a huge issue and there are several bugs opened years ago, covering parts of it, but there still is no fix in sight.
When tx_form is used and it's frontend output is changed, according to the documentation, with the layout configuration (either tt_content.mailform.20.layout or in the FORM object itself), the resulting E-Mail is unreadable, because the MailPostProcessor tries to add these styles in the mail. Even worse, if you do change the label, the sending process breaks with
#1: PHP Catchable Fatal Error: Argument 3 passed to TYPO3\CMS\Form\View\Mail\Html\Element\AbstractElementView::replaceNodeWithFragment() must be an instance of DOMNode, null given, called in /var/www/typo3_src-6.2.2/typo3/sysext/form/Classes/View/Mail/Html/Element/AbstractElementView.php on line 111 and defined in /var/www/typo3_src-6.2.2/typo3/sysext/form/Classes/View/Mail/Html/Element/AbstractElementView.php line 228
A minimal example can be created by setting the label layout to literally anything, even the default value, according to doc, breaks when set manual.
tt_content.mailform.20.layout.label = <label><labelvalue /><mandatory /><error /></label>
When you do submit any form with this conf, the above error is thrown.
Updated by Matthias Kuchem over 6 years ago
Yes, thanks for the feedback.
For anyone running into this problem (since the old configuration still exists in documentation and probably tutorials): Move your configuration from tt_content.mailform.20.layout to tt_content.mailform.20.form.layout. For details see #31951 and the linked changeset.