From 9082bf1e55d71c73417bb46cb5b50dcbfbcc86c3 Mon Sep 17 00:00:00 2001
From: Nicole Cordes <typo3@cordes.co>
Date: Mon, 13 Jul 2015 11:40:06 +0200
Subject: [PATCH] [BUGFIX] Make editIconsHook work again

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 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/typo3/sysext/filelist/Classes/FileList.php b/typo3/sysext/filelist/Classes/FileList.php
index 66a2ca0ac649..5ccd7d6cb53f 100644
--- a/typo3/sysext/filelist/Classes/FileList.php
+++ b/typo3/sysext/filelist/Classes/FileList.php
@@ -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>';
-- 
GitLab