1<?php 2 3declare(strict_types=1); 4 5/* 6 * This file is part of the TYPO3 CMS project. 7 * 8 * It is free software; you can redistribute it and/or modify it under 9 * the terms of the GNU General Public License, either version 2 10 * of the License, or any later version. 11 * 12 * For the full copyright and license information, please read the 13 * LICENSE.txt file that was distributed with this source code. 14 * 15 * The TYPO3 project - inspiring people to share! 16 */ 17 18namespace TYPO3\CMS\Form\Hooks; 19 20use TYPO3\CMS\Core\Utility\StringUtility; 21use TYPO3\CMS\Filelist\FileList; 22use TYPO3\CMS\Filelist\FileListEditIconHookInterface; 23use TYPO3\CMS\Form\Mvc\Persistence\FormPersistenceManager; 24 25/** 26 * @internal 27 */ 28class FileListEditIconsHook implements FileListEditIconHookInterface 29{ 30 31 /** 32 * Modifies edit icon array 33 * 34 * @param array $cells 35 * @param FileList $parentObject 36 */ 37 public function manipulateEditIcons(&$cells, &$parentObject) 38 { 39 $fileOrFolderObject = $cells['__fileOrFolderObject']; 40 $fullIdentifier = $fileOrFolderObject->getCombinedIdentifier(); 41 $isFormDefinition = StringUtility::endsWith($fullIdentifier, FormPersistenceManager::FORM_DEFINITION_FILE_EXTENSION); 42 43 if (!$isFormDefinition) { 44 return; 45 } 46 47 $disableIconNames = ['edit', 'view', 'replace', 'rename']; 48 foreach ($disableIconNames as $disableIconName) { 49 if (!empty($cells[$disableIconName])) { 50 $cells[$disableIconName] = $parentObject->spaceIcon; 51 } 52 } 53 } 54} 55