Commit b3e183e1 authored by Benjamin Serfhos's avatar Benjamin Serfhos Committed by Frank Nägler
Browse files

[BUGFIX] Add icon rendering for custom permissions options

The icon rendering of custom page options was lost during
refactoring of the ItemProviders.

Resolves: #77075
Releases: master, 7.6
Change-Id: Iae6415525d94fc56c48332de9e5bc3980344fbc2
Reviewed-on: https://review.typo3.org/48967

Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Frank Nägler's avatarFrank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Nägler's avatarFrank Naegler <frank.naegler@typo3.org>
parent 0020a944
......@@ -24,6 +24,7 @@ use TYPO3\CMS\Core\Database\Query\QueryHelper;
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\Database\RelationHandler;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Imaging\IconRegistry;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Messaging\FlashMessageQueue;
use TYPO3\CMS\Core\Messaging\FlashMessageService;
......@@ -159,6 +160,7 @@ abstract class AbstractItemProvider
}
$languageService = $this->getLanguageService();
$iconRegistry = GeneralUtility::makeInstance(IconRegistry::class);
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
$special = $result['processedTca']['columns'][$fieldName]['config']['special'];
......@@ -292,6 +294,12 @@ abstract class AbstractItemProvider
foreach ($coValue['items'] as $itemKey => $itemCfg) {
$icon = 'empty-empty';
$helpText = [];
if (!empty($itemCfg[1])) {
if ($iconRegistry->isRegistered($itemCfg[1])) {
// Use icon identifier when registered
$icon = $itemCfg[1];
}
}
if (!empty($itemCfg[2])) {
$helpText['description'] = $languageService->sL($itemCfg[2]);
}
......
......@@ -1093,6 +1093,11 @@ class TcaSelectItemsTest extends UnitTestCase
'anItemKey' => [
0 => 'anItemTitle',
],
'anotherKey' => [
0 => 'anotherTitle',
1 => 'status-status-permission-denied',
2 => 'aDescription',
],
],
]
];
......@@ -1110,6 +1115,12 @@ class TcaSelectItemsTest extends UnitTestCase
2 => 'empty-empty',
3 => null,
],
2 => [
0 => 'anotherTitle',
1 => 'aKey:anotherKey',
2 => 'status-status-permission-denied',
3 => [ 'description' => 'aDescription' ],
],
];
$result = $this->subject->addData($input);
......
......@@ -2995,7 +2995,7 @@ class IconRegistry implements SingletonInterface
* @param string $iconReference
* @return string
*/
protected function detectIconProvider($iconReference)
public function detectIconProvider($iconReference)
{
if (StringUtility::endsWith(strtolower($iconReference), 'svg')) {
return SvgIconProvider::class;
......
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