Skip to content
This repository has been archived by the owner on Feb 3, 2025. It is now read-only.

TypeError when editing a translate page #421

Open
DanielSiepmann opened this issue Nov 3, 2020 · 0 comments
Open

TypeError when editing a translate page #421

DanielSiepmann opened this issue Nov 3, 2020 · 0 comments

Comments

@DanielSiepmann
Copy link

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);
+        }
     }
 
     /**
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant