Skip to content

Always register FormEngine inline settings #51

Description

@konradmichalik

Problem

Opening a module that extends AbstractBackendController with the default WORKSPACE_ID = 0 throws on every page load:

  Uncaught TypeError: Cannot read properties of undefined (reading 'formName') at form-engine.js 

Root Cause

AbstractBackendController::loadWorkspaceScripts() only registers the FormEngine inline setting inside the if ($this::WORKSPACE_ID) branch.

However, Resources/Public/JavaScript/recordlist-row-edit-multiple.js uses top.TYPO3.settings.FormEngine.moduleUrl unconditionally and pulls @typo3/backend/form-engine.js as a transitive dependency. form-engine.js reads TYPO3.settings.FormEngine.formName at module-evaluation time, so it throws when the setting is missing.

Fix

Move the two FormEngine inline settings out of the workspace branch — they are required by the row-edit JS regardless of workspace mode. Workspaces, RecordHistory and WebLayout stay workspace-only.

 protected function loadWorkspaceScripts(): void                                                                      
 {                                     
+    $this->pageRenderer->addInlineSetting(
+        'FormEngine',
+        'moduleUrl',
+        (string)$this->backendUriBuilder->buildUriFromRoute('record_edit')                                                                                                                                                                                                                                                                                                                                               
+    );
+    $this->pageRenderer->addInlineSetting('FormEngine', 'formName', 'editform');                                                                                                                                                                                                                                                                                                                                         
+                                                                                                                                                                                                                                                                                                                                                                                                                         
     if ($this::WORKSPACE_ID) {        
-        $this->pageRenderer->addInlineSetting(                                                                                                                                                                                                                                                                                                                                                                           
-            'FormEngine',                                                                                                                                                                                                                                                                                                                                                                                                
-            'moduleUrl',              
-            (string)$this->backendUriBuilder->buildUriFromRoute('record_edit')                                                                                                                                                                                                                                                                                                                                           
-        );                                                                                                           
         // ...                        
     }                                                                                                                                                                                                                                                                                                                                                                                                                    
 }

Environment

  • TYPO3 v13.4
  • xima/xima-typo3-recordlist 14.0.0
  • PHP 8.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions