diff --git a/typo3/sysext/form/Classes/Controller/FormEditorController.php b/typo3/sysext/form/Classes/Controller/FormEditorController.php
index 394472d38963f1b715336f7fb2ab07f9d45d9356..c79c4db3b2add05c90957f7d1124a783ad2c1537 100644
--- a/typo3/sysext/form/Classes/Controller/FormEditorController.php
+++ b/typo3/sysext/form/Classes/Controller/FormEditorController.php
@@ -18,7 +18,6 @@ declare(strict_types=1);
 namespace TYPO3\CMS\Form\Controller;
 
 use Psr\Http\Message\ResponseInterface;
-use Psr\Http\Message\ServerRequestInterface;
 use TYPO3\CMS\Backend\Routing\UriBuilder;
 use TYPO3\CMS\Backend\Template\Components\ButtonBar;
 use TYPO3\CMS\Backend\Template\ModuleTemplate;
@@ -33,11 +32,12 @@ use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
 use TYPO3\CMS\Core\Utility\ArrayUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\PathUtility;
+use TYPO3\CMS\Core\View\ViewFactoryData;
+use TYPO3\CMS\Core\View\ViewFactoryInterface;
 use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
 use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
 use TYPO3\CMS\Extbase\Mvc\RequestInterface;
 use TYPO3\CMS\Extbase\Mvc\View\JsonView;
-use TYPO3\CMS\Fluid\View\TemplateView;
 use TYPO3\CMS\Form\Domain\Configuration\ConfigurationService;
 use TYPO3\CMS\Form\Domain\Configuration\FormDefinitionConversionService;
 use TYPO3\CMS\Form\Domain\Exception\RenderingException;
@@ -70,6 +70,7 @@ class FormEditorController extends ActionController
         protected readonly ConfigurationService $configurationService,
         protected readonly UriBuilder $coreUriBuilder,
         protected readonly ArrayFormFactory $arrayFormFactory,
+        protected readonly ViewFactoryInterface $viewFactory,
     ) {}
 
     /**
@@ -425,10 +426,13 @@ class FormEditorController extends ActionController
             throw new RenderingException('The option partialRootPaths must be set.', 1480294722);
         }
         $insertRenderablesPanelConfiguration = $this->getInsertRenderablesPanelConfiguration($prototypeConfiguration, $formEditorDefinitions['formElements']);
-        $view = GeneralUtility::makeInstance(TemplateView::class);
-        $view->getRenderingContext()->setAttribute(ServerRequestInterface::class, $this->request);
-        $view->getRenderingContext()->getTemplatePaths()->fillFromConfigurationArray($fluidConfiguration);
-        $view->setTemplatePathAndFilename($fluidConfiguration['templatePathAndFilename']);
+        $viewFactoryData = new ViewFactoryData(
+            templatePathAndFilename: $fluidConfiguration['templatePathAndFilename'],
+            partialRootPaths: $fluidConfiguration['partialRootPaths'],
+            layoutRootPaths: $fluidConfiguration['layoutRootPaths'],
+            request: $this->request,
+        );
+        $view = $this->viewFactory->create($viewFactoryData);
         $view->assignMultiple([
             'insertRenderablesPanelConfiguration' => $insertRenderablesPanelConfiguration,
             'formEditorPartials' => $formEditorPartials,
diff --git a/typo3/sysext/form/Tests/Functional/Controller/FormEditorControllerTest.php b/typo3/sysext/form/Tests/Functional/Controller/FormEditorControllerTest.php
index b795f78868a81e790bb5e86aaa095b57f3c7ce1b..1cb30d57dd357b360fe48feee7a79d743fdf3857 100644
--- a/typo3/sysext/form/Tests/Functional/Controller/FormEditorControllerTest.php
+++ b/typo3/sysext/form/Tests/Functional/Controller/FormEditorControllerTest.php
@@ -22,6 +22,7 @@ use TYPO3\CMS\Backend\Routing\UriBuilder;
 use TYPO3\CMS\Backend\Template\ModuleTemplateFactory;
 use TYPO3\CMS\Core\Imaging\IconFactory;
 use TYPO3\CMS\Core\Page\PageRenderer;
+use TYPO3\CMS\Core\View\ViewFactoryInterface;
 use TYPO3\CMS\Form\Controller\FormEditorController;
 use TYPO3\CMS\Form\Domain\Configuration\ConfigurationService;
 use TYPO3\CMS\Form\Domain\Configuration\FormDefinitionConversionService;
@@ -59,6 +60,7 @@ final class FormEditorControllerTest extends FunctionalTestCase
                 $this->createMock(ConfigurationService::class),
                 $this->createMock(UriBuilder::class),
                 $this->createMock(ArrayFormFactory::class),
+                $this->createMock(ViewFactoryInterface::class),
             ],
         );
         $prototypeConfiguration = [
@@ -151,6 +153,7 @@ final class FormEditorControllerTest extends FunctionalTestCase
                 $this->createMock(ConfigurationService::class),
                 $this->createMock(UriBuilder::class),
                 $this->createMock(ArrayFormFactory::class),
+                $this->createMock(ViewFactoryInterface::class),
             ],
         );
         $prototypeConfiguration = [