diff --git a/typo3/sysext/backend/Classes/Utility/BackendUtility.php b/typo3/sysext/backend/Classes/Utility/BackendUtility.php index 338e2d6346b533082eb9d6da26b46a5a5f9bf482..36421e9dcb95a50178ee24e1889cd23b416ff2a7 100644 --- a/typo3/sysext/backend/Classes/Utility/BackendUtility.php +++ b/typo3/sysext/backend/Classes/Utility/BackendUtility.php @@ -2049,54 +2049,6 @@ class BackendUtility return ''; } - /** - * Returns a JavaScript string for viewing the page id, $id - * It will re-use any window already open. - * - * @param int $pageUid Page UID - * @param string $backPath Must point back to TYPO3_mainDir (where the site is assumed to be one level above) - * @param array|null $rootLine If root line is supplied the function will look for the first found domain record and use that URL instead (if found) - * @param string $anchorSection Optional anchor to the URL - * @param string $alternativeUrl An alternative URL that, if set, will ignore other parameters except $switchFocus: It will return the window.open command wrapped around this URL! - * @param string $additionalGetVars Additional GET variables. - * @param bool $switchFocus If TRUE, then the preview window will gain the focus. - * @return string - * @deprecated Use TYPO3\CMS\Backend\Routing\PreviewUriBuilder instead, will be removed in TYPO3 v12.0 - */ - public static function viewOnClick( - $pageUid, - $backPath = '', - $rootLine = null, - $anchorSection = '', - $alternativeUrl = '', - $additionalGetVars = '', - $switchFocus = true - ) { - trigger_error( - 'Using BackendUtility::viewOnClick() is deprecated, use TYPO3\CMS\Backend\Routing\PreviewUriBuilder instead.', - E_USER_DEPRECATED - ); - try { - $previewUrl = self::getPreviewUrl( - $pageUid, - $backPath, - $rootLine, - $anchorSection, - $alternativeUrl, - $additionalGetVars, - $switchFocus - ); - } catch (UnableToLinkToPageException $e) { - return ''; - } - - $onclickCode = 'var previewWin = window.open(' . GeneralUtility::quoteJSvalue($previewUrl) . ',\'newTYPO3frontendWindow\');' - . ($switchFocus ? 'previewWin.focus();' : '') . LF - . 'if (previewWin.location.href === ' . GeneralUtility::quoteJSvalue($previewUrl) . ') { previewWin.location.reload(); };'; - - return $onclickCode; - } - /** * Returns the preview url * diff --git a/typo3/sysext/backend/Tests/UnitDeprecated/Utility/BackendUtilityTest.php b/typo3/sysext/backend/Tests/UnitDeprecated/Utility/BackendUtilityTest.php deleted file mode 100644 index 3b7531f6abb20c1126ee0e79403ef42609870022..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Tests/UnitDeprecated/Utility/BackendUtilityTest.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ - -namespace TYPO3\CMS\Backend\Tests\UnitDeprecated\Utility; - -use TYPO3\CMS\Backend\Utility\BackendUtility; -use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\TestingFramework\Core\Unit\UnitTestCase; - -/** - * Test case - */ -class BackendUtilityTest extends UnitTestCase -{ - /** - * @test - */ - public function viewOnClickReturnsOnClickCodeWithAlternativeUrl(): void - { - // Make sure the hook inside viewOnClick is not fired. This may be removed if unit tests - // bootstrap does not initialize TYPO3_CONF_VARS anymore. - unset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['viewOnClickClass']); - - $alternativeUrl = 'https://typo3.org/about/typo3-the-cms/the-history-of-typo3/#section'; - $onclickCode = 'var previewWin = window.open(' . GeneralUtility::quoteJSvalue($alternativeUrl) . ',\'newTYPO3frontendWindow\');' . LF - . 'if (previewWin.location.href === ' . GeneralUtility::quoteJSvalue($alternativeUrl) . ') { previewWin.location.reload(); };'; - self::assertStringMatchesFormat( - $onclickCode, - BackendUtility::viewOnClick(null, null, null, null, $alternativeUrl, null, false) - ); - } -} diff --git a/typo3/sysext/core/Documentation/Changelog/12.0/Breaking-96107-DeprecatedFunctionalityRemoved.rst b/typo3/sysext/core/Documentation/Changelog/12.0/Breaking-96107-DeprecatedFunctionalityRemoved.rst index 679f97f0e4fa2d773f735d9b54ba27733cfffe2b..50797ba0cece33c2cc9aedfaa756fa5e78343c1e 100644 --- a/typo3/sysext/core/Documentation/Changelog/12.0/Breaking-96107-DeprecatedFunctionalityRemoved.rst +++ b/typo3/sysext/core/Documentation/Changelog/12.0/Breaking-96107-DeprecatedFunctionalityRemoved.rst @@ -43,6 +43,7 @@ The following PHP static class methods that have previously been marked as depre - :php:`\TYPO3\CMS\Backend\Utility\BackendUtility::fixVersioningPid()` - :php:`\TYPO3\CMS\Core\Utility\GeneralUtility::stdAuthCode()` +- :php:`\TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick` The following methods changed signature according to previous deprecations in v11 at the end of the argument list: diff --git a/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallStaticMatcher.php b/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallStaticMatcher.php index c782c9ac0bc0ce6a55f32c188337d966fa41c4cb..5db349fe8c7cd53c81fc154b6a1e978f1d0e7ded 100644 --- a/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallStaticMatcher.php +++ b/typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallStaticMatcher.php @@ -939,6 +939,7 @@ return [ 'restFiles' => [ 'Important-91123-AvoidUsingBackendUtilityViewOnClick.rst', 'Deprecation-91806-BackendUtilityViewOnClick.rst', + 'Breaking-96107-DeprecatedFunctionalityRemoved.rst', ], ], 'TYPO3\CMS\Core\Utility\GeneralUtility::getApplicationContext' => [