[BUGFIX] Fix broken hook in DatabaseRecordList 13/39913/3
authorTim Lochmüller <tim@fruit-lab.de>
Wed, 3 Jun 2015 09:39:18 +0000 (11:39 +0200)
committerAndreas Fernandez <typo3@scripting-base.de>
Fri, 5 Jun 2015 07:42:20 +0000 (09:42 +0200)
This patch fix broken hook in DatabaseRecordList,
If there are more than one hook registered, the compatibility layer is
broken, because the restructure process of the cells was executed
multiple times.

Resolves: #67270
Releases: master
Change-Id: If9ea77c4b79076f39dc622cc3258f4e2dccceff0
Reviewed-on: http://review.typo3.org/39913
Reviewed-by: Frank Nägler <typo3@naegler.net>
Tested-by: Frank Nägler <typo3@naegler.net>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php

index 872e859..a582060 100644 (file)
@@ -1407,18 +1407,18 @@ class DatabaseRecordList extends AbstractDatabaseRecordList {
                 *        The order of the icons is depending on the order of those array entries.
                 */
                if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
+                       // for compatibility reason, we move all icons to the rootlevel
+                       // before calling the hooks
+                       foreach ($cells as $section => $actions) {
+                               foreach ($actions as $actionKey => $action) {
+                                       $cells[$actionKey] = $action;
+                               }
+                       }
                        foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
                                $hookObject = GeneralUtility::getUserObj($classData);
                                if (!$hookObject instanceof RecordListHookInterface) {
                                        throw new \UnexpectedValueException('$hookObject must implement interface ' . RecordListHookInterface::class, 1195567840);
                                }
-                               // for compatibility reason, we move all icons to the rootlevel
-                               // before calling the hook
-                               foreach ($cells as $section => $actions) {
-                                       foreach ($actions as $actionKey => $action) {
-                                               $cells[$actionKey] = $action;
-                                       }
-                               }
                                $cells = $hookObject->makeControl($table, $row, $cells, $this);
                        }
                        // now sort icons again into primary and secondary sections