[BUGFIX] Make editIconsHook work again 89/42589/2
authorNicole Cordes <typo3@cordes.co>
Mon, 13 Jul 2015 09:40:06 +0000 (11:40 +0200)
committerHelmut Hummel <helmut.hummel@typo3.org>
Fri, 14 Aug 2015 07:12:21 +0000 (09:12 +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/42589
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
typo3/sysext/filelist/Classes/FileList.php

index 415fc58..6a17cdc 100644 (file)
@@ -934,6 +934,7 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\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 \TYPO3\CMS\Filelist\FileListEditIconHookInterface) {
@@ -944,6 +945,7 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                                }
                                $hookObject->manipulateEditIcons($cells, $this);
                        }
+                       unset($cells['__fileOrFolderObject']);
                }
                // Compile items into a DIV-element:
                return '                                                        <!-- EDIT CONTROLS: -->