Commit 2a08fd09 authored by Benni Mack's avatar Benni Mack Committed by Christian Kuhn
Browse files

[!!!][TASK] Remove legacy Element Browser hooks

The hook $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering']
is replaced in favor of the Element Browser registry.

Related: #95322
Resolves: #96123
Releases: master
Change-Id: If362551cf7c4a093cde4e0742037155afedbea32
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72345

Tested-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent dae3aeb0
......@@ -93,6 +93,7 @@ The following global variables have been removed:
The following hooks have been removed:
- :php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['FileDumpEID.php']['checkFileAccess']`
- :php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering']`
The following signals have been removed:
......
......@@ -531,6 +531,7 @@ return [
'$GLOBALS[\'TYPO3_CONF_VARS\'][\'SC_OPTIONS\'][\'typo3/browse_links.php\'][\'browserRendering\']' => [
'restFiles' => [
'Deprecation-95322-LegacyElementBrowserLogic.rst',
'Breaking-96107-DeprecatedFunctionalityRemoved.rst',
],
],
'$GLOBALS[\'TBE_MODULES_EXT\'][\'xMOD_db_new_content_el\'][\'addElClasses\']' => [
......
......@@ -17,10 +17,8 @@ namespace TYPO3\CMS\Recordlist\Controller;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Http\HtmlResponse;
use TYPO3\CMS\Core\Http\RedirectResponse;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Recordlist\Browser\ElementBrowserInterface;
......@@ -55,12 +53,6 @@ class ElementBrowserController
{
$this->getLanguageService()->includeLLFile('EXT:recordlist/Resources/Private/Language/locallang_browse_links.xlf');
$this->mode = $request->getQueryParams()['mode'] ?? $request->getQueryParams()['mode'] ?? '';
// Fallback for old calls, which use mode "wizard" or "rte" for link selection
if ($this->mode === 'wizard' || $this->mode === 'rte') {
trigger_error('Calling ElementBrowserController::mainAction with "wizard" or "mode" as values will be removed in TYPO3 v12.0. Link to the "wizard_link" instead.', E_USER_DEPRECATED);
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
return new RedirectResponse((string)$uriBuilder->buildUriFromRoute('wizard_link', $_GET), 303);
}
return new HtmlResponse($this->main($request));
}
......@@ -71,42 +63,17 @@ class ElementBrowserController
*/
protected function main(ServerRequestInterface $request)
{
$content = '';
// Render type by user func
$browserRendered = false;
// @deprecated will be removed in TYPO3 v12.0.
if (!empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'] ?? [])) {
trigger_error('$TYPO3_CONF_VARS[SC_OPTIONS][typo3/browse_links.php][browserRendering] will be removed in TYPO3 v12.0. Use a custom ElementBrowser, as introduced in TYPO3 7.6, instead.', E_USER_DEPRECATED);
}
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'] ?? [] as $className) {
$browserRenderObj = GeneralUtility::makeInstance($className);
if (is_object($browserRenderObj) && method_exists($browserRenderObj, 'isValid') && method_exists($browserRenderObj, 'render')) {
if ($browserRenderObj->isValid($this->mode, $this)) {
$content = $browserRenderObj->render($this->mode, $this);
$browserRendered = true;
break;
}
}
$browser = $this->getElementBrowserInstance();
if (is_callable([$browser, 'setRequest'])) {
$browser->setRequest($request);
}
// if type was not rendered use default rendering functions
if (!$browserRendered) {
$browser = $this->getElementBrowserInstance();
if (is_callable([$browser, 'setRequest'])) {
$browser->setRequest($request);
}
$backendUser = $this->getBackendUser();
$modData = $backendUser->getModuleData('browse_links.php', 'ses');
[$modData] = $browser->processSessionData($modData);
$backendUser->pushModuleData('browse_links.php', $modData);
$content = $browser->render();
}
$backendUser = $this->getBackendUser();
$modData = $backendUser->getModuleData('browse_links.php', 'ses');
[$modData] = $browser->processSessionData($modData);
$backendUser->pushModuleData('browse_links.php', $modData);
return $content;
return $browser->render();
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment