Deprecation: #109230 - FormResultCompiler
See forge#109230
Description
The class
\TYPO3\ has been deprecated.
Internal building of FormEngine was adjusted to better separate concerns,
especially regarding rendering and asset handling. This change also removed
all internal usages of
Form, as it handled more tasks
than its name suggested.
Impact
Extensions and installations that render FormEngine forms manually, rather
than through standard controllers like
Edit, and
which utilize
\TYPO3\ will see the
class removed in TYPO3 v15.
Affected installations
Installations and extensions using
\TYPO3\
to build FormEngine forms.
Migration
Replace usage of
Form with
Form and
Form.
Before:
use TYPO3\CMS\Backend\Form\NodeFactory;
use TYPO3\CMS\Backend\Form\FormResultCompiler;
use TYPO3\CMS\Core\Utility\GeneralUtility;
$nodeFactory = GeneralUtility::makeInstance(NodeFactory::class);
$formResultCompiler = GeneralUtility::makeInstance(FormResultCompiler::class);
$formResult = $nodeFactory->create($formData)->render();
$formResultCompiler->mergeResult($formResult);
// Form HTML markup is accessible in the data array
$body = $formResult['html'];
After:
use TYPO3\CMS\Backend\Form\NodeFactory;
use TYPO3\CMS\Backend\Form\FormResultFactory;
use TYPO3\CMS\Backend\Form\FormResultHandler;
use TYPO3\CMS\Core\Utility\GeneralUtility;
$nodeFactory = GeneralUtility::makeInstance(NodeFactory::class);
$formResultFactory = GeneralUtility::makeInstance(FormResultFactory::class);
$formResultHandler = GeneralUtility::makeInstance(FormResultHandler::class);
$formResult = $nodeFactory->create($formData)->render();
// Convert the raw result array into a FormResult object
$formResult = $formResultFactory->create($formResult);
// Use FormResultHandler to pass collected assets (JS, CSS, labels) to PageRenderer
$formResultHandler->addAssets($formResult);
// Form HTML markup is accessible in the FormResult DTO
$body = $formResult->html;