diff --git a/typo3/sysext/backend/Classes/Controller/BackendController.php b/typo3/sysext/backend/Classes/Controller/BackendController.php index bff93714611c90fb1028e5f0be85b944398b1bbf..1e65fe5a6273acdf711a14dbf93dabe385e8b696 100644 --- a/typo3/sysext/backend/Classes/Controller/BackendController.php +++ b/typo3/sysext/backend/Classes/Controller/BackendController.php @@ -179,12 +179,15 @@ class BackendController /** * Add hooks from the additional backend items to load certain things for the main backend. * This was previously called from the global scope from backend.php. + * + * Please note that this method will be removed in TYPO3 v9. it does not throw a deprecation warning as it is protected and still called on every main backend request. */ protected function includeLegacyBackendItems() { $TYPO3backend = $this; // Include extensions which may add css, javascript or toolbar items if (is_array($GLOBALS['TYPO3_CONF_VARS']['typo3/backend.php']['additionalBackendItems'])) { + GeneralUtility::deprecationLog('The hook $TYPO3_CONF_VARS["typo3/backend.php"]["additionalBackendItems"] is deprecated in TYPO3 v8, and will be removed in TYPO3 v9. Use the "constructPostProcess" hook within BackendController instead.'); foreach ($GLOBALS['TYPO3_CONF_VARS']['typo3/backend.php']['additionalBackendItems'] as $additionalBackendItem) { include_once $additionalBackendItem; } @@ -192,7 +195,7 @@ class BackendController // Process ExtJS module js and css if (is_array($GLOBALS['TBE_MODULES']['_configuration'])) { - foreach ($GLOBALS['TBE_MODULES']['_configuration'] as $moduleConfig) { + foreach ($GLOBALS['TBE_MODULES']['_configuration'] as $moduleName => $moduleConfig) { if (is_array($moduleConfig['cssFiles'])) { foreach ($moduleConfig['cssFiles'] as $cssFileName => $cssFile) { $cssFile = GeneralUtility::getFileAbsFileName($cssFile); @@ -836,9 +839,11 @@ class BackendController * @param string $javascript Javascript snippet * @return void * @throws \InvalidArgumentException + * @deprecated since TYPO3 v8, will be removed in TYPO3 v9. Use the "constructPostProcess" hook within BackendController instead. */ public function addJavascript($javascript) { + GeneralUtility::logDeprecatedFunction(); // @todo do we need more checks? if (!is_string($javascript)) { throw new \InvalidArgumentException('parameter $javascript must be of type string', 1195129553); @@ -851,9 +856,11 @@ class BackendController * * @param string $javascriptFile Javascript file reference * @return bool TRUE if the javascript file was successfully added, FALSE otherwise + * @deprecated since TYPO3 v8, will be removed in TYPO3 v9. Use the "constructPostProcess" hook within BackendController instead. */ public function addJavascriptFile($javascriptFile) { + GeneralUtility::logDeprecatedFunction(); $jsFileAdded = false; // @todo add more checks if necessary if (file_exists(GeneralUtility::resolveBackPath(PATH_typo3 . $javascriptFile))) { @@ -884,9 +891,11 @@ class BackendController * @param string $cssFileName The css file's name with out the .css ending * @param string $cssFile Css file reference * @return bool TRUE if the css file was added, FALSE otherwise + * @deprecated since TYPO3 v8, will be removed in TYPO3 v9, use the according PageRenderer methods directly */ public function addCssFile($cssFileName, $cssFile) { + GeneralUtility::logDeprecatedFunction(); $cssFileAdded = false; if (empty($this->cssFiles[$cssFileName])) { $this->cssFiles[$cssFileName] = $cssFile; diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-80491-BackendControllerInclusionHooks.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-80491-BackendControllerInclusionHooks.rst new file mode 100644 index 0000000000000000000000000000000000000000..ebe1e3a9d5e069798ce955cd9a3e53f9b1b7df34 --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-80491-BackendControllerInclusionHooks.rst @@ -0,0 +1,47 @@ +.. include:: ../../Includes.txt + +======================================================= +Deprecation: #80491 - BackendController inclusion hooks +======================================================= + +See :issue:`80491` + +Description +=========== + +The hook within BackendController `$TYPO3_CONF_VARS["typo3/backend.php"]["additionalBackendItems"]` +has been marked as deprecated. + +Loading ExtJS module JS/CSS files via `ExtensionManagementUtility::addExtJSModule()` inside +the module configuration has been deprecated. + +Calling `BackendController->addJavascriptFile()`, `BackendController->addJavascript()` +and `BackendController->addCssFile()` will trigger a deprecation log entry. + + +Impact +====== + +Registering a hook via `$TYPO3_CONF_VARS["typo3/backend.php"]["additionalBackendItems"]` and then +calling the Backend main page will trigger a deprecation log warning. + +Registering any backend module which should load a global CSS/JS file within a module configuration +will trigger a deprecation log warning. + +Calling any of the methods above will trigger a deprecation log warning. + + +Affected Installations +====================== + +Any installation using the hook or PHP methods directly in a custom extension, or using any of +the public methods above in a custom PHP script. + + +Migration +========= + +Use the "constructPostProcess" hook within BackendController to load additional resources to achieve +the same functionality. + +.. index:: Backend, PHP-API \ No newline at end of file