From 76200bfb40365d12e0d9c4d1379d228977e622e1 Mon Sep 17 00:00:00 2001 From: Georg Ringer Date: Wed, 12 Apr 2023 06:55:05 +0200 Subject: [PATCH] [BUGFIX] Better check for existing be zuser --- Classes/Hooks/StdWrapEditPanelHook.php | 28 ++++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/Classes/Hooks/StdWrapEditPanelHook.php b/Classes/Hooks/StdWrapEditPanelHook.php index 1288c77..b1486bc 100644 --- a/Classes/Hooks/StdWrapEditPanelHook.php +++ b/Classes/Hooks/StdWrapEditPanelHook.php @@ -37,20 +37,22 @@ class StdWrapEditPanelHook implements ContentObjectStdWrapHookInterface public function stdWrapPostProcess($content, array $configuration, ContentObjectRenderer &$parentObject) { - $configurationService = GeneralUtility::makeInstance(ConfigurationService::class); $user = $this->getFrontendBackendUser(); - if ($user && ($configuration['editPanel'] ?? false) && StateUtility::isOpen() && $configurationService->getConfigurationOption('edit', 'displayIcons')) { - [$table, $uid] = explode(':', $parentObject->currentRecord); - $allowedActions = $user->getAllowedEditActions($table, $configuration['editPanel.'] ?? [], $parentObject->data['pid']); - $frontendEditPanel = GeneralUtility::makeInstance(FrontendEditPanel::class, $parentObject); - return $frontendEditPanel->editPanel( - $content, - $configuration['editPanel.'] ?? [], - $parentObject->currentRecord, - $parentObject->data, - 'tt_content', - $allowedActions - ); + if ($user) { + $configurationService = GeneralUtility::makeInstance(ConfigurationService::class); + if (($configuration['editPanel'] ?? false) && StateUtility::isOpen() && $configurationService->getConfigurationOption('edit', 'displayIcons')) { + [$table, $uid] = explode(':', $parentObject->currentRecord); + $allowedActions = $user->getAllowedEditActions($table, $configuration['editPanel.'] ?? [], $parentObject->data['pid']); + $frontendEditPanel = GeneralUtility::makeInstance(FrontendEditPanel::class, $parentObject); + return $frontendEditPanel->editPanel( + $content, + $configuration['editPanel.'] ?? [], + $parentObject->currentRecord, + $parentObject->data, + 'tt_content', + $allowedActions + ); + } } return $content; }