diff --git a/Classes/FrontendEditPanel.php b/Classes/FrontendEditPanel.php index 54addc2..0133177 100644 --- a/Classes/FrontendEditPanel.php +++ b/Classes/FrontendEditPanel.php @@ -13,7 +13,7 @@ namespace TYPO3\CMS\Feedit; * * The TYPO3 project - inspiring people to share! */ -use TYPO3\CMS\Adminpanel\View\AdminPanelView; +use TYPO3\CMS\Adminpanel\Service\EditToolbarService; use TYPO3\CMS\Backend\FrontendBackendUserAuthentication; use TYPO3\CMS\Core\Imaging\Icon; use TYPO3\CMS\Core\Imaging\IconFactory; @@ -97,8 +97,9 @@ class FrontendEditPanel $hideField = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled']; $panel = ''; - if (isset($allow['toolbar']) && $this->backendUser->adminPanel instanceof AdminPanelView) { - $panel .= $this->backendUser->adminPanel->ext_makeToolBar(); + if (isset($allow['toolbar'])) { + $editToolbarService = GeneralUtility::makeInstance(EditToolbarService::class); + $panel .= $editToolbarService->createToolbar(); } if (isset($allow['edit'])) { $icon = '' . $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render('inline') . ''; diff --git a/Classes/Middleware/FrontendEditInitiator.php b/Classes/Middleware/FrontendEditInitiator.php new file mode 100644 index 0000000..96c7ede --- /dev/null +++ b/Classes/Middleware/FrontendEditInitiator.php @@ -0,0 +1,67 @@ +getTSConfigProp('admPanel'); + $active = (int)$GLOBALS['TSFE']->displayEditIcons === 1 || (int)$GLOBALS['TSFE']->displayFieldEditIcons === 1; + if ($active && isset($config['enable.'])) { + foreach ($config['enable.'] as $value) { + if ($value) { + if ($GLOBALS['TSFE'] instanceof TypoScriptFrontendController) { + // Grab the Page TSConfig property that determines which controller to use. + $pageTSConfig = $GLOBALS['TSFE']->getPagesTSconfig(); + $controllerKey = $pageTSConfig['TSFE.']['frontendEditingController'] ?? 'default'; + } else { + $controllerKey = 'default'; + } + $controllerClass = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController'][$controllerKey]; + if ($controllerClass) { + $GLOBALS['BE_USER']->frontendEdit = GeneralUtility::makeInstance($controllerClass); + } + break; + } + } + } + } + return $handler->handle($request); + } +} diff --git a/Configuration/RequestMiddlewares.php b/Configuration/RequestMiddlewares.php new file mode 100644 index 0000000..71ca4ac --- /dev/null +++ b/Configuration/RequestMiddlewares.php @@ -0,0 +1,21 @@ + [ + * 'middleware-identifier' => [ + * 'target' => classname or callable + * 'before/after' => array of dependencies + * ] + * ] + */ +return [ + 'frontend' => [ + 'typo3/cms-frontendedit/initiator' => [ + 'target' => \TYPO3\CMS\Feedit\Middleware\FrontendEditInitiator::class, + 'after' => [ + 'typo3/cms-adminpanel/initiator', + 'typo3/cms-frontend/page-resolver', + ] + ], + ] +]; diff --git a/composer.json b/composer.json index 45608ec..0579243 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,13 @@ "sort-packages": true }, "require": { - "typo3/cms-core": "9.2.*@dev" + "typo3/cms-adminpanel": "9.2.*@dev", + "typo3/cms-backend": "9.2.*@dev", + "typo3/cms-core": "9.2.*@dev", + "typo3/cms-frontend": "9.2.*@dev", + "psr/http-message": "~1.0", + "psr/http-server-handler": "^1.0", + "psr/http-server-middleware": "^1.0" }, "conflict": { "typo3/cms": "*"