diff --git a/typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php b/typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php index a767f3f6a9df029f2af3ff412b2b0ec11bab96c9..41b232a9ba3e012f395e5fb5882c3d3df1a2cb87 100644 --- a/typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php +++ b/typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php @@ -544,6 +544,10 @@ abstract class AbstractItemProvider $icon = reset($references); $icon = $icon->getPublicUrl(); } + } else { + // Else, determine icon based on record type, or a generic fallback + $iconFactory = GeneralUtility::makeInstance(IconFactory::class); + $icon = $iconFactory->mapRecordTypeToIconIdentifier($foreignTable, $foreignRow); } // Add the item $items[] = [ diff --git a/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaSelectItemsTest.php b/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaSelectItemsTest.php index 48a08a6208925aa232156613588d0f8c22edfcd3..52a1b21bf2c15a34c505a23378e9e2a72d6efb27 100644 --- a/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaSelectItemsTest.php +++ b/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaSelectItemsTest.php @@ -2041,6 +2041,9 @@ class TcaSelectItemsTest extends UnitTestCase $fileRepositoryProphecy->findByRelation(Argument::cetera())->shouldNotBeCalled(); GeneralUtility::setSingletonInstance(FileRepository::class, $fileRepositoryProphecy->reveal()); + $iconFactoryProphecy = $this->prophesize(IconFactory::class); + GeneralUtility::addInstance(IconFactory::class, $iconFactoryProphecy->reveal()); + /** @var BackendUserAuthentication|ObjectProphecy $backendUserProphecy */ $backendUserProphecy = $this->prophesize(BackendUserAuthentication::class); $GLOBALS['BE_USER'] = $backendUserProphecy->reveal(); @@ -2129,6 +2132,9 @@ class TcaSelectItemsTest extends UnitTestCase $fileRepositoryProphecy->findByRelation(Argument::cetera())->shouldNotBeCalled(); GeneralUtility::setSingletonInstance(FileRepository::class, $fileRepositoryProphecy->reveal()); + $iconFactoryProphecy = $this->prophesize(IconFactory::class); + GeneralUtility::addInstance(IconFactory::class, $iconFactoryProphecy->reveal()); + $resourceStorageProphecy = $this->prophesize(ResourceStorage::class); $resourceStorageProphecy->getUid()->willReturn(1); @@ -2933,6 +2939,9 @@ class TcaSelectItemsTest extends UnitTestCase $fileRepositoryProphecy->findByRelation(Argument::cetera())->shouldNotBeCalled(); GeneralUtility::setSingletonInstance(FileRepository::class, $fileRepositoryProphecy->reveal()); + $iconFactoryProphecy = $this->prophesize(IconFactory::class); + GeneralUtility::addInstance(IconFactory::class, $iconFactoryProphecy->reveal()); + /** @var BackendUserAuthentication|ObjectProphecy $backendUserProphecy */ $backendUserProphecy = $this->prophesize(BackendUserAuthentication::class); $GLOBALS['BE_USER'] = $backendUserProphecy->reveal(); @@ -3044,6 +3053,9 @@ class TcaSelectItemsTest extends UnitTestCase $fileRepositoryProphecy->findByRelation(Argument::cetera())->shouldNotBeCalled(); GeneralUtility::setSingletonInstance(FileRepository::class, $fileRepositoryProphecy->reveal()); + $iconFactoryProphecy = $this->prophesize(IconFactory::class); + GeneralUtility::addInstance(IconFactory::class, $iconFactoryProphecy->reveal()); + /** @var BackendUserAuthentication|ObjectProphecy $backendUserProphecy */ $backendUserProphecy = $this->prophesize(BackendUserAuthentication::class); $GLOBALS['BE_USER'] = $backendUserProphecy->reveal(); @@ -3164,6 +3176,9 @@ class TcaSelectItemsTest extends UnitTestCase $fileRepositoryProphecy->findByRelation(Argument::cetera())->shouldNotBeCalled(); GeneralUtility::setSingletonInstance(FileRepository::class, $fileRepositoryProphecy->reveal()); + $iconFactoryProphecy = $this->prophesize(IconFactory::class); + GeneralUtility::addInstance(IconFactory::class, $iconFactoryProphecy->reveal()); + /** @var BackendUserAuthentication|ObjectProphecy $backendUserProphecy */ $backendUserProphecy = $this->prophesize(BackendUserAuthentication::class); $GLOBALS['BE_USER'] = $backendUserProphecy->reveal(); @@ -3285,6 +3300,9 @@ class TcaSelectItemsTest extends UnitTestCase $fileRepositoryProphecy->findByRelation(Argument::cetera())->shouldNotBeCalled(); GeneralUtility::setSingletonInstance(FileRepository::class, $fileRepositoryProphecy->reveal()); + $iconFactoryProphecy = $this->prophesize(IconFactory::class); + GeneralUtility::addInstance(IconFactory::class, $iconFactoryProphecy->reveal()); + /** @var BackendUserAuthentication|ObjectProphecy $backendUserProphecy */ $backendUserProphecy = $this->prophesize(BackendUserAuthentication::class); $GLOBALS['BE_USER'] = $backendUserProphecy->reveal();