diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-90937-VariousHooksInContentObjectRenderer.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-90937-VariousHooksInContentObjectRenderer.rst new file mode 100644 index 0000000000000000000000000000000000000000..75b6518a20a4476c3fdde8987063d286ba20e987 --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-90937-VariousHooksInContentObjectRenderer.rst @@ -0,0 +1,46 @@ +.. include:: ../../Includes.txt + +============================================================ +Deprecation: #90937 - Various hooks in ContentObjectRenderer +============================================================ + +See :issue:`90937` + +Description +=========== + +The following hooks within ContentObjectRenderer have been deprecated: + +* $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClass'] +* $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClassDefault'] +* $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['extLinkATagParamsHandler'] +* $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['typolinkLinkHandler'] + +All hooks have been available for a long time, and several new concepts and APIs that have been added in previous LTS versions already superseded the hooks. + + +Impact +====== + +Extensions registering the hook will trigger a PHP deprecation notice when one of the mentioned hooks when the code is executed. + + +Affected Installations +====================== + +TYPO3 installations with older extensions implementing one of the hooks above, which is very rare and only serve specific use-cases +for rendering ContentObjects or custom link style tags that are not related to TYPO3 v8 linking syntax (`t3://...`). + + +Migration +========= + +The hooks `cObjTypeAndClass` and `cObjTypeAndClassDefault` can be simplified by using the new way of registering custom ContentObjects via: + +:php:`$GLOBALS['TYPO3_CONF_VARS']['FE']['ContentObjects']` - see `EXT:frontend/ext_localconf.php` for examples - TYPO3 Core adds its shipped ContentObjects exactly the same way. + +The `typolinkLinkHandler` hook is used for registering custom link syntax that start with a certain keyword such as "news:13". + +Since TYPO3 v8, LinkHandler support has been added to TYPO3 Core natively, using the new `t3://` syntax. The "LinkHandler" registry can be extended via :php:`$GLOBALS['TYPO3_CONF_VARS']['SYS']['linkHandler']` and :php:`$GLOBALS['TYPO3_CONF_VARS']['FE']['typolinkBuilder']` that serves the same purpose with a better API. + +.. index:: Frontend, FullyScanned, ext:frontend \ No newline at end of file diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectGetSingleHookInterface.php b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectGetSingleHookInterface.php index 0ee7f9d4dda957355b2c232212a3ff0601d50e88..e1274d45d5fab21702e77ca73ad9421832a3d411 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectGetSingleHookInterface.php +++ b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectGetSingleHookInterface.php @@ -16,6 +16,8 @@ namespace TYPO3\CMS\Frontend\ContentObject; /** * Interface for classes which hook into \TYPO3\CMS\Frontend\ContentObject and do additional cObjGetSingle processing + * + * @deprecated will be removed in TYPO3 v11, as this functionality has been moved into `$GLOBALS['TYPO3_CONF_VARS']['FE']['ContentObjects']` */ interface ContentObjectGetSingleHookInterface { diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php index 541cce5db5f9b5b8ae7eab8fb82b7568b77bf7c4..1fb87f1db8e15e9a71b2fbcd6ad4bdf330cbfb4c 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php +++ b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php @@ -392,11 +392,13 @@ class ContentObjectRenderer implements LoggerAwareInterface * Additionally registered content object types and class names * * @var array + * @deprecated - will be removed in TYPO3 v11.0 */ protected $cObjHookObjectsRegistry = []; /** * @var array + * @deprecated - will be removed in TYPO3 v11.0 */ public $cObjHookObjectsArr = []; @@ -565,6 +567,7 @@ class ContentObjectRenderer implements LoggerAwareInterface : ''; $this->parameters = []; foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClass'] ?? [] as $classArr) { + trigger_error('The hook $TYPO3_CONF_VARS[SC_OPTIONS][tslib/class.tslib_content.php][cObjTypeAndClass] for adding custom cObjects will be removed in TYPO3 v11.0. Use a custom cObject which you can register directly instead.', E_USER_DEPRECATED); $this->cObjHookObjectsRegistry[$classArr[0]] = $classArr[1]; } $this->stdWrapHookObjects = []; @@ -721,6 +724,7 @@ class ContentObjectRenderer implements LoggerAwareInterface } else { $hooked = false; // Application defined cObjects + // @deprecated since TYPO3 v10.4 - will be removed in TYPO3 v11.0 if (!empty($this->cObjHookObjectsRegistry[$name])) { if (empty($this->cObjHookObjectsArr[$name])) { $this->cObjHookObjectsArr[$name] = GeneralUtility::makeInstance($this->cObjHookObjectsRegistry[$name]); @@ -738,6 +742,9 @@ class ContentObjectRenderer implements LoggerAwareInterface } else { // Call hook functions for extra processing if ($name) { + if (!empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClassDefault'])) { + trigger_error('The hook $TYPO3_CONF_VARS[SC_OPTIONS][tslib/class.tslib_content.php][cObjTypeAndClassDefault] for adding custom processing will be removed. Use a custom cObject which you can register directly instead.', E_USER_DEPRECATED); + } foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClassDefault'] ?? [] as $className) { $hookObject = GeneralUtility::makeInstance($className); if (!$hookObject instanceof ContentObjectGetSingleHookInterface) { @@ -1552,11 +1559,13 @@ class ContentObjectRenderer implements LoggerAwareInterface * @param string $URL URL of the website * @param string $TYPE * @return string The additional tag properties + * @internal This method will be removed as it serves no purpose anymore in TYPO3 v11.0 */ public function extLinkATagParams($URL, $TYPE) { $out = ''; if (!empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['extLinkATagParamsHandler'])) { + trigger_error('The hook $TYPO3_CONF_VARS[SC_OPTIONS][tslib/class.tslib_content.php][extLinkATagParamsHandler] will be removed in TYPO3 v11.0. Use a custom LinkHandler instead.', E_USER_DEPRECATED); $extLinkATagParamsHandler = GeneralUtility::makeInstance($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['extLinkATagParamsHandler']); if (method_exists($extLinkATagParamsHandler, 'main')) { $out .= trim($extLinkATagParamsHandler->main($URL, $TYPE, $this)); @@ -4963,6 +4972,7 @@ class ContentObjectRenderer implements LoggerAwareInterface if (!empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['typolinkLinkHandler'][$linkHandlerKeyword]) && (string)$linkHandlerValue !== '' ) { + trigger_error('The hook $TYPO3_CONF_VARS[SC_OPTIONS][tslib/class.tslib_content.php][typolinkLinkHandler] will be removed in TYPO3 v11.0. Use a custom LinkHandler instead. The used link handler keyword was: ' . $linkHandlerKeyword, E_USER_DEPRECATED); $linkHandlerObj = GeneralUtility::makeInstance($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['typolinkLinkHandler'][$linkHandlerKeyword]); if (method_exists($linkHandlerObj, 'main')) { return $linkHandlerObj->main($linkText, $configuration, $linkHandlerKeyword, $linkHandlerValue, $mixedLinkParameter, $this); diff --git a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayDimensionMatcher.php b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayDimensionMatcher.php index cd4427ccdf1292d9de437ef24ab1882dd0f088dd..26c3acef6b4d1847a7502f5bd641fcbf12701948 100644 --- a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayDimensionMatcher.php +++ b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayDimensionMatcher.php @@ -371,4 +371,24 @@ return [ 'Deprecation-88740-DeprecateFeloginPibasePlugin.rst', ], ], + '$GLOBALS[\'TYPO3_CONF_VARS\'][\'SC_OPTIONS\'][\'tslib/class.tslib_content.php\'][\'cObjTypeAndClass\']' => [ + 'restFiles' => [ + 'Deprecation-90937-VariousHooksInContentObjectRenderer.rst', + ], + ], + '$GLOBALS[\'TYPO3_CONF_VARS\'][\'SC_OPTIONS\'][\'tslib/class.tslib_content.php\'][\'cObjTypeAndClassDefault\']' => [ + 'restFiles' => [ + 'Deprecation-90937-VariousHooksInContentObjectRenderer.rst', + ], + ], + '$GLOBALS[\'TYPO3_CONF_VARS\'][\'SC_OPTIONS\'][\'tslib/class.tslib_content.php\'][\'extLinkATagParamsHandler\']' => [ + 'restFiles' => [ + 'Deprecation-90937-VariousHooksInContentObjectRenderer.rst', + ], + ], + '$GLOBALS[\'TYPO3_CONF_VARS\'][\'SC_OPTIONS\'][\'tslib/class.tslib_content.php\'][\'typolinkLinkHandler\']' => [ + 'restFiles' => [ + 'Deprecation-90937-VariousHooksInContentObjectRenderer.rst', + ], + ], ]; diff --git a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php index eabc22a054db7aba0b81fdf90f7a02f07b9f02e3..8afba7fb77eeb6420878ce2f786d6dcb73505f4a 100644 --- a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php +++ b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php @@ -1407,4 +1407,9 @@ return [ 'Deprecation-90692-DeprecateFileCollectionModels.rst', ], ], + 'TYPO3\CMS\Frontend\ContentObject\ContentObjectGetSingleHookInterface' => [ + 'restFiles' => [ + 'Deprecation-90937-VariousHooksInContentObjectRenderer.rst', + ], + ], ];