[BUGFIX] Make editIconsHook work again 17/41117/2
authorNicole Cordes <typo3@cordes.co>
Mon, 13 Jul 2015 09:40:06 +0000 (11:40 +0200)
committerHelmut Hummel <helmut.hummel@typo3.org>
Mon, 13 Jul 2015 13:51:03 +0000 (15:51 +0200)
It isn't possible to add icons in filelist extended view easily,
because there is no way to get the current file or folder object nor get
information about it. This patch adds the object to the cells variable
and reset it after hook execution to ensure access to it.

Releases: master, 6.2
Resolves: #67962
Change-Id: I44a4229128bcfdb2ed17900462f50a771ed63fdd
Reviewed-on: http://review.typo3.org/41117
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
typo3/sysext/filelist/Classes/FileList.php

index 66a2ca0..5ccd7d6 100644 (file)
@@ -929,6 +929,7 @@ class FileList extends AbstractRecordList {
 
                // Hook for manipulating edit icons.
                if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'])) {
+                       $cells['__fileOrFolderObject'] = $fileOrFolderObject;
                        foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['fileList']['editIconsHook'] as $classData) {
                                $hookObject = GeneralUtility::getUserObj($classData);
                                if (!$hookObject instanceof FileListEditIconHookInterface) {
@@ -939,6 +940,7 @@ class FileList extends AbstractRecordList {
                                }
                                $hookObject->manipulateEditIcons($cells, $this);
                        }
+                       unset($cells['__fileOrFolderObject']);
                }
                // Compile items into a DIV-element:
                return '<div class="btn-group">' . implode('', $cells) . '</div>';