[BUGFIX] PageLayoutController must only use available actions for view/edit 82/44082/5
authorAndreas Allacher <andreas.allacher@gmx.at>
Thu, 15 Oct 2015 13:22:04 +0000 (15:22 +0200)
committerFrank Nägler <frank.naegler@typo3.org>
Fri, 30 Oct 2015 12:52:35 +0000 (13:52 +0100)
Ensure that only available actions are shown via PageLayoutController,
e.g. if you remove QuickEdit and the user had previously set the module
to QuickEdit.

Change-Id: Iec8d552965ea351393a218a68ba3166b674ef51b
Resolves: #70767
Releases: master
Reviewed-on: https://review.typo3.org/44082
Reviewed-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Tested-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Reviewed-by: Frank Nägler <frank.naegler@typo3.org>
Tested-by: Frank Nägler <frank.naegler@typo3.org>
typo3/sysext/backend/Classes/Controller/PageLayoutController.php

index d6043df..7c7c675 100755 (executable)
@@ -443,16 +443,25 @@ class PageLayoutController
         $actionMenu->setIdentifier('actionMenu');
         $actionMenu->setLabel('');
 
+        $defaultKey = null;
         foreach ($availableActionArray as $key => $action) {
             $menuItem = $actionMenu
                 ->makeMenuItem()
                 ->setTitle($action)
                 ->setHref(BackendUtility::getModuleUrl($this->moduleName) . '&id=' . $this->id . '&SET[function]=' . $key);
+
+            if (!isset($defaultKey)) {
+                $defaultKey = $key;
+            }
             if ((int)$this->MOD_SETTINGS['function'] === $key) {
                 $menuItem->setActive(true);
+                $defaultKey = null;
             }
             $actionMenu->addMenuItem($menuItem);
         }
+        if (isset($defaultKey)) {
+            $this->MOD_SETTINGS['function'] = $defaultKey;
+        }
         $this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->addMenu($actionMenu);
     }