Commit 4bb09190 authored by Oliver Bartsch's avatar Oliver Bartsch Committed by Daniel Goerz
Browse files

[BUGFIX] Bring back record type icons for select items

With the removal of `selicon_field_path` in #87937 also the
automatic record type icon mapping was removed.

As a result the record icon of a select item based on `foreign_table`
is not resolved anymore. In addition, the `selectIcons` list is therefore
no longer displayed.

The previous functionality is now restored.

Resolves: #91302
Relates: #87937
Releases: master
Change-Id: If62f4ba65ef54ec2345131f6c117ce4336e76c4c
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64560


Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: Daniel Goerz's avatarDaniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Daniel Goerz's avatarDaniel Goerz <daniel.goerz@posteo.de>
parent 62f2c36f
......@@ -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[] = [
......
......@@ -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();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment