[BUGFIX] Add missing new_content_element overrides in PageLayoutView 81/46681/5
authorRichard Haeser <richardhaeser@gmail.com>
Mon, 15 Feb 2016 19:50:33 +0000 (20:50 +0100)
committerFrank Naegler <frank.naegler@typo3.org>
Fri, 19 Feb 2016 17:30:27 +0000 (18:30 +0100)
Add the missing override possibilities in PageLayoutView as introduced
by issue #70055. Also add check if the override attribute of
newContentElementWizard is set in the tsConfig array.

Change-Id: Iaa5952c3dedca2b3dfec84e36d55e453e7ad690e
Resolves: #73444
Releases: master, 7.6
Reviewed-on: https://review.typo3.org/46681
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
typo3/sysext/backend/Classes/ClickMenu/ClickMenu.php
typo3/sysext/backend/Classes/Controller/NewRecordController.php
typo3/sysext/backend/Classes/View/PageLayoutView.php
typo3/sysext/frontend/Classes/View/AdminPanelView.php
typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php

index 2b601c8..848aead 100644 (file)
@@ -680,7 +680,9 @@ class ClickMenu
         } else {
             //  If mod.newContentElementWizard.override is set, use a custom module instead
             $tsConfig = BackendUtility::getModTSconfig((int)$this->pageinfo['uid'], 'mod');
-            $newContentWizardModuleName = $tsConfig['properties']['newContentElementWizard.']['override'] ?: 'new_content_element';
+            $newContentWizardModuleName = isset($tsConfig['properties']['newContentElementWizard.']['override'])
+                ? $tsConfig['properties']['newContentElementWizard.']['override']
+                : 'new_content_element';
             $url = BackendUtility::getModuleUrl($newContentWizardModuleName, ['id' => $rec['pid'], 'sys_language_uid' => (int)$rec['sys_language_uid']]);
         }
         return $this->linkItem(
index 1f4f354..d6c5cef 100644 (file)
@@ -501,7 +501,9 @@ class NewRecordController extends AbstractModule
                             $rowContent = $newContentIcon . '<strong>' . $lang->getLL('createNewContent') . '</strong><ul>';
                             // If mod.newContentElementWizard.override is set, use that extension's wizard instead:
                             $tsConfig = BackendUtility::getModTSconfig($this->id, 'mod');
-                            $moduleName = $tsConfig['properties']['newContentElementWizard.']['override'] ?: 'new_content_element';
+                            $moduleName = isset($tsConfig['properties']['newContentElementWizard.']['override'])
+                                ? $tsConfig['properties']['newContentElementWizard.']['override']
+                                : 'new_content_element';
                             $url = BackendUtility::getModuleUrl($moduleName, ['id' => $this->id, 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')]);
                             $rowContent .= '<li>' . $newLink . ' ' . BackendUtility::wrapInHelp($table, '') . '</li><li><a href="' . htmlspecialchars($url) . '">' . $newContentIcon . htmlspecialchars($lang->getLL('clickForWizard')) . '</a></li></ul>';
                         } else {
index 90bd119..9e2c1b0 100644 (file)
@@ -529,7 +529,11 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
                             'uid_pid' => $id,
                             'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
                         ];
-                        $url = BackendUtility::getModuleUrl('new_content_element', $urlParameters);
+                        $tsConfig = BackendUtility::getModTSconfig($id, 'mod');
+                        $moduleName = isset($tsConfig['properties']['newContentElementWizard.']['override'])
+                            ? $tsConfig['properties']['newContentElementWizard.']['override']
+                            : 'new_content_element';
+                        $url = BackendUtility::getModuleUrl($moduleName, $urlParameters);
                     } else {
                         $urlParameters = [
                             'edit' => [
@@ -640,7 +644,11 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
                                         'uid_pid' => -$row['uid'],
                                         'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
                                     ];
-                                    $url = BackendUtility::getModuleUrl('new_content_element', $urlParameters);
+                                    $tsConfig = BackendUtility::getModTSconfig($row['pid'], 'mod');
+                                    $moduleName = isset($tsConfig['properties']['newContentElementWizard.']['override'])
+                                        ? $tsConfig['properties']['newContentElementWizard.']['override']
+                                        : 'new_content_element';
+                                    $url = BackendUtility::getModuleUrl($moduleName, $urlParameters);
                                 } else {
                                     $urlParameters = [
                                         'edit' => [
@@ -1822,7 +1830,11 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
     public function newContentElementOnClick($id, $colPos, $sys_language)
     {
         if ($this->option_newWizard) {
-            $onClick = 'window.location.href=' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('new_content_element') . '&id=' . $id . '&colPos=' . $colPos
+            $tsConfig = BackendUtility::getModTSconfig($id, 'mod');
+            $moduleName = isset($tsConfig['properties']['newContentElementWizard.']['override'])
+                ? $tsConfig['properties']['newContentElementWizard.']['override']
+                : 'new_content_element';
+            $onClick = 'window.location.href=' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl($moduleName) . '&id=' . $id . '&colPos=' . $colPos
                 . '&sys_language_uid=' . $sys_language . '&uid_pid=' . $id
                 . '&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI'))) . ';';
         } else {
index cd7503e..980e37c 100755 (executable)
@@ -649,7 +649,9 @@ class AdminPanelView
         $tsfe = $this->getTypoScriptFrontendController();
         //  If mod.newContentElementWizard.override is set, use that extension's create new content wizard instead:
         $tsConfig = BackendUtility::getModTSconfig($tsfe->page['uid'], 'mod');
-        $moduleName = $tsConfig['properties']['newContentElementWizard.']['override'] ?: 'new_content_element';
+        $moduleName = isset($tsConfig['properties']['newContentElementWizard.']['override'])
+            ? $tsConfig['properties']['newContentElementWizard.']['override']
+            : 'new_content_element';
         $newContentWizScriptPath = BackendUtility::getModuleUrl($moduleName);
         $perms = $this->getBackendUser()->calcPerms($tsfe->page);
         $langAllowed = $this->getBackendUser()->checkLanguageAccess($tsfe->sys_language_uid);
index 8cde014..9e41947 100644 (file)
@@ -1131,7 +1131,9 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
                             if ($table === 'tt_content' && $this->newWizards) {
                                 // If mod.newContentElementWizard.override is set, use that extension's create new content wizard instead:
                                 $tmpTSc = BackendUtility::getModTSconfig($this->pageinfo['uid'], 'mod');
-                                $newContentElementWizard = $tmpTSc['properties']['newContentElementWizard.']['override'] ?: 'new_content_element';
+                                $newContentElementWizard = isset($tmpTSc['properties']['newContentElementWizard.']['override'])
+                                    ? $tmpTSc['properties']['newContentElementWizard.']['override']
+                                    : 'new_content_element';
                                 $newContentWizScriptPath = BackendUtility::getModuleUrl($newContentElementWizard, array('id' => $this->id));
 
                                 $onClick = 'return jumpExt(' . GeneralUtility::quoteJSvalue($newContentWizScriptPath) . ');';