From 958795c7db824ee96d42389357d12cfcf31842f8 Mon Sep 17 00:00:00 2001 From: Benni Mack <benni@typo3.org> Date: Wed, 9 Nov 2016 22:51:18 +0100 Subject: [PATCH] [!!!][BUGFIX] Allow override of page creation wizard again The TSconfig option to override the page creation wizard via `mod.web_list.newPageWiz.overrideWithExtension` is impossible to use anymore since TYPO3 v8, due to the limitation of the entry-scripts which are only allowed to be in typo3/index.php for the backend. The option `mod.newPageWizard.override` was introduced to register a custom route / module to be linked when adding new pages. Resolves: #78549 Releases: master Change-Id: I1c46c8facad83c0d561028e544f18238abe89f91 Reviewed-on: https://review.typo3.org/50560 Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de> Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de> Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Susanne Moog <susanne.moog@typo3.org> Tested-by: Susanne Moog <susanne.moog@typo3.org> --- .../Classes/Tree/View/PagePositionMap.php | 22 +++++---- ...dePagePositionMapWizardViaPageTSconfig.rst | 48 +++++++++++++++++++ 2 files changed, 60 insertions(+), 10 deletions(-) create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Breaking-78549-OverridePagePositionMapWizardViaPageTSconfig.rst diff --git a/typo3/sysext/backend/Classes/Tree/View/PagePositionMap.php b/typo3/sysext/backend/Classes/Tree/View/PagePositionMap.php index df37bce3bbee..45e487498068 100644 --- a/typo3/sysext/backend/Classes/Tree/View/PagePositionMap.php +++ b/typo3/sysext/backend/Classes/Tree/View/PagePositionMap.php @@ -23,9 +23,7 @@ use TYPO3\CMS\Core\Database\Query\Restriction\HiddenRestriction; use TYPO3\CMS\Core\Database\Query\Restriction\StartTimeRestriction; use TYPO3\CMS\Core\Imaging\Icon; use TYPO3\CMS\Core\Imaging\IconFactory; -use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Core\Utility\PathUtility; use TYPO3\CMS\Lang\LanguageService; /** @@ -262,8 +260,8 @@ class PagePositionMap /** * Creates the onclick event for the insert-icons. * - * TSconfig mod.web_list.newPageWiz.overrideWithExtension may contain an extension which provides a module - * to be used instead of the normal create new page wizard. + * TSconfig mod.newPageWizard.override may contain an alternative module / route which can be + * used instead of the normal create new page wizard. * * @param int $pid The pid. * @param int $newPagePID New page id. @@ -271,12 +269,16 @@ class PagePositionMap */ public function onClickEvent($pid, $newPagePID) { - $TSconfigProp = $this->getModConfig($newPagePID); - if ($TSconfigProp['overrideWithExtension']) { - if (ExtensionManagementUtility::isLoaded($TSconfigProp['overrideWithExtension'])) { - $onclick = 'window.location.href=' . GeneralUtility::quoteJSvalue(PathUtility::getAbsoluteWebPath(ExtensionManagementUtility::extPath($TSconfigProp['overrideWithExtension'])) . 'mod1/index.php?cmd=crPage&positionPid=' . $pid) . ';'; - return $onclick; - } + $TSconfig = BackendUtility::getModTSconfig($newPagePID, 'mod.newPageWizard'); + $TSconfig = $TSconfig['properties']; + if (isset($TSconfig['override']) && !empty($TSconfig['override'])) { + $url = BackendUtility::getModuleUrl($TSconfig['override'], [ + 'positionPid' => $pid, + 'newPageId' => $newPagePID, + 'cmd' => 'crPage', + 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')] + ); + return 'window.location.href=' . GeneralUtility::quoteJSvalue($url) . ';'; } $params = '&edit[pages][' . $pid . ']=new&returnNewPageId=1'; return BackendUtility::editOnClick($params, '', $this->R_URI); diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-78549-OverridePagePositionMapWizardViaPageTSconfig.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-78549-OverridePagePositionMapWizardViaPageTSconfig.rst new file mode 100644 index 000000000000..1b34c736d91b --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Breaking-78549-OverridePagePositionMapWizardViaPageTSconfig.rst @@ -0,0 +1,48 @@ +.. include:: ../../Includes.txt + +====================================================================== +Breaking: #78549 - Override New Page Creation Wizard via page TSconfig +====================================================================== + +See :issue:`78549` + +Description +=========== + +In the past it was possible to override the "New Page Creation Wizard" via custom scripts +when using page TSconfig via ``mod.web_list.newPageWiz.overrideWithExtension = myextension`` to define an extension, +which then needed a file placed under ``mod1/index.php``. The script was then called with certain parameters instead +of the wizard. + +The new way of handling entry-points and custom scripts is now built via modules and routes. The former option +``mod.web_list.newPageWiz.overrideWithExtension`` has been removed and a new option +``mod.newPageWizard.override`` was introduced instead. Instead of setting the option to a certain extension key, +a custom module or route has to be specified. + +Example: + +.. code-block:: typoscript + + mod.newPageWizard.override = my_custom_module + + +Impact +====== + +Using the old TSconfig option ``mod.web_list.newPageWiz.overrideWithExtension`` has no effect anymore and +will fallback to the regular new page creation wizard provided by the TYPO3 Core. + + +Affected Installations +====================== + +Any installation using this option with extensions providing custom New Page Wizards, e.g. templavoila. + + +Migration +========= + +The extension providing the script must be changed to register a route or module and set the TSconfig option to the route identifier, +instead of a raw PHP script. Any usages in TSconfig need to be adapted to use the new TSconfig option. + +.. index:: Backend, TSConfig -- GitLab