fluidpages icon indicating copy to clipboard operation
fluidpages copied to clipboard

TypeError when editing a translate page

Open DanielSiepmann opened this issue 4 years ago • 0 comments

I tried to debug the issue for a customer, but have zero understand of this extension and its purpose.

The issue is:

(1/1) TypeError

Argument 1 passed to TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection::add() must be an instance of TYPO3\CMS\Backend\View\BackendLayout\BackendLayout, null given, called in /project/web/typo3conf/ext/fluidpages/Classes/Backend/BackendLayoutDataProvider.php on line 92

And it appears when editing the translation record of the root page in TYPO3 CMS 9.5.22. I don't know where to start or which information are necessary, due to the lack of the understanding of this extension.

I found out that this change would fix the issue, but as I lack the understanding, I'm not sure if this would be a fix or instead would hide a different issue, like miss configuration.

diff --git a/Classes/Backend/BackendLayoutDataProvider.php b/Classes/Backend/BackendLayoutDataProvider.php
index 8492883..ab1a4ba 100644
--- a/Classes/Backend/BackendLayoutDataProvider.php
+++ b/Classes/Backend/BackendLayoutDataProvider.php
@@ -89,7 +89,10 @@ class BackendLayoutDataProvider extends DefaultDataProvider implements DataProvi
         DataProviderContext $dataProviderContext,
         BackendLayoutCollection $backendLayoutCollection
     ) {
-        $backendLayoutCollection->add($this->getBackendLayout('fluidpages', $dataProviderContext->getPageId()));
+        $layout = $this->getBackendLayout('fluidpages', $dataProviderContext->getPageId());
+        if ($layout instanceof BackendLayout) {
+            $backendLayoutCollection->add($layout);
+        }
     }
 
     /**

DanielSiepmann avatar Nov 03 '20 11:11 DanielSiepmann