Commit beb53574 authored by Benni Mack's avatar Benni Mack
Browse files

[TASK] Deprecate legacy Element Browser logic

The hook
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering']
is deprecated in favor of the ElementBrowser API
implemented in TYPO3 v7.6 via https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/7.6/Feature-66369-AddedLinkBrowserAPIs.html

Also, calling "wizard_element_browser" with mode=wizard
or "mode=rte" is deprecated, instead extensions should link to
"wizard_link", which also exists since TYPO3 v8.

Resolves: #95322
Releases: master
Change-Id: I4ad30fa0b0c0684767e1060d99cebc11b7db9710
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/71180

Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent a16e5643
.. include:: ../../Includes.txt
==================================================
Deprecation: #95322 - Legacy Element Browser logic
==================================================
See :issue:`95322`
Description
===========
The hook :php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering']` is marked
as deprecated as it has been superseded by the ElementBrowser API,
introduced in TYPO3 v7.6.
Calling the Backend Routing Endpoint "wizard_element_browser"
called via `?mode=wizard` or `?mode=rte` is deprecated.
Impact
======
Calling the Backend Routing Endpoint "wizard_element_browser"
called via `?mode=wizard` or `?mode=rte` will trigger a PHP deprecation warning.
Accessing the Element Browser with a registered hook will also
trigger a PHP deprecation warning.
Affected Installations
======================
TYPO3 installations with legacy code (such as an old Element
Browser hook) or with old links to "wizard_element_browser"
prior to TYPO3 v8 which hasn't been updated yet.
Migration
=========
Use the Element Browser API, introduced in TYPO3 v7.6 instead of the deprecated hook `$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering']`.
Instead of referencing "wizard_element_browser" for accessing
the wizard, the link wizard with BE Routing Endpoint "wizard_link"
should be used instead.
.. index:: Backend, PHP-API, PartiallyScanned, ext:recordlist
\ No newline at end of file
......@@ -527,4 +527,9 @@ return [
'Deprecation-95105-DatabaseRecordListHooks.rst',
],
],
'$GLOBALS[\'TYPO3_CONF_VARS\'][\'SC_OPTIONS\'][\'typo3/browse_links.php\'][\'browserRendering\']' => [
'restFiles' => [
'Deprecation-95322-LegacyElementBrowserLogic.rst',
],
],
];
......@@ -57,6 +57,7 @@ class ElementBrowserController
$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);
}
......@@ -74,6 +75,11 @@ class ElementBrowserController
// 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')) {
......@@ -106,8 +112,6 @@ class ElementBrowserController
/**
* Get instance of the actual element browser
*
* This method shall be overwritten in subclasses
*
* @return ElementBrowserInterface
* @throws \UnexpectedValueException
*/
......
Supports Markdown
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