Issue Bug Closed

#105994Strange behaviour of icon use in custom content elements

Michael Perlbach 01/27/25, 19:52 updated 04/21/26, 22:43

Description

Hi,

It seems impossible for me to add icons to my custom content element. The TSConfig for my new content element wizard is this:

mod.wizards{
newContentElement.wizardItems{
common{
elements{
artofffunc_kunstort {
iconIdentifier = artofffunc-kunstort
title = LLL:EXT:artofffunc/Resources/Private/Language/locallang_be.xlf:artoff_kunstort
description = LLL:EXT:artofffunc/Resources/Private/Language/locallang_be.xlf:kunstort_description
tt_content_defValues {
CType = artofffunc_kunstort
}
}
}
}
}
}

In my “Icons.php” I assign an icon image to the iconIdentifier:

return [
‘artofffunc-kunstort’ => [
‘provider’ => SvgIconProvider::class,
‘source’ => ‘EXT:artofffunc/Resources/Public/Icons/artofffunc-kunstort.svg’,
],
];

So far so good. Now:
When I change the iconIdentifier in “NewContentElement.tsconfig” and “Icons.php” appropriately I get a broken icon. No matter what I do it never works. Clearing the TYPO3 caches did not help. When I name it back to the original iconIdentifier the icon is found again. When I keep the original iconIdentifier and change the icon file in “Icons.php” I still see the previous icon but not the new file.
I hope I made myself clear.

Is there some sort of caching mechanism for icons at work here – or how can this problem be otherwise remedied?

Thatnks for feedback
Michael

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 8

  1. Garvin Hicking commented and changed status New Needs Feedback <span data-processor="relativetime" data-value="2025-01-27T23:39:28+00:00" > 01/27/25, 23:39 </span>

    Could it be related to this, which funnily just got bumped today:

    https://forge.typo3.org/issues/105946#change-536013

    Does clearing your browser’s localStorage (browser console) help?

  2. Michael Perlbach commented <span data-processor="relativetime" data-value="2025-01-28T03:19:20+00:00" > 01/28/25, 03:19 </span>

    Yes, that was exactly my problem. Clearing the browser’s localStorage helped.
    However, this “feature” should be either mentioned in the documentation or – even better – omitted.

    I also wonder why at some places SVG icons are displayed as inline markups and at other places referred by an tag. But that is another thing.

  3. Garvin Hicking commented and changed status Needs Feedback Closed <span data-processor="relativetime" data-value="2025-01-28T07:38:05+00:00" > 01/28/25, 07:38 </span>

    Thanks for the quick reply. I will close this issue as a duplicate, if you want you can share your thoughts on the other issue? Thanks for bringing this up. (I don’t know about the specifics of that functionality atm)

  4. Michael Perlbach commented <span data-processor="relativetime" data-value="2025-01-28T12:04:22+00:00" > 01/28/25, 12:04 </span>

    When I use an SVG in the “new Content Elment” Wizard it is always rendered as an inline markup – whether you want it or not. You have to register your icon in “Icons.php”, set the iconIdentifier – and you only have the choice of “SvgIconProvider” as provider – which renders the SVG as inline markup. I looked the generation of SVG markup a bit up and I think I understand the reason for doing this – it is mainly a security feature as the generation of the SVG markup removes all possible Javascript from the SVG source.

    For TCA table definitions on the other hand one can only specify an “iconfile” in the “ctrl” section – which then is reandered as an image tag. There’s nothing one can do about it. So – as the icon for the “new Content Elment” Wizard is secure, the same icon is not secure in the form rendered from TCA settings.

    This could be remedied if “iconIdentifier” and – say – “iconProvider” also works in the “ctrl” part of a TCA form definition. Maybe it’s already possbile but I did not try it out as the documentation tells otherwise – and I do not have anything maliciuos in my SVG icons :-)

    I hope I made myself clear.

  5. Michael Perlbach commented <span data-processor="relativetime" data-value="2025-01-28T12:34:47+00:00" > 01/28/25, 12:34 </span>

    I also found this link concerning possible security problems in SVGs.

    https://news.ycombinator.com/item?id=39079943

  6. Michael Perlbach commented and changed TYPO3 Version 13 14 PHP Version 8.2 8.3 <span data-processor="relativetime" data-value="2026-04-21T19:01:30+00:00" > 04/21/26, 19:01 </span>

    I would like to reopen this because the problem reoccurs in Version 14.x – and this time cleaning the local storage did not help.

    What I found out is that the icons defined in Icons.php and referenced as iconIdentifier in NewContentElement.tsconfig never seem to be processed by SvgIconProvider.

  7. Michael Perlbach commented <span data-processor="relativetime" data-value="2026-04-21T22:43:01+00:00" > 04/21/26, 22:43 </span>

    Ok, I understood what wrong. A “NewContentElement.tsconfig” is no longer needed. Instead everything is configured in the TCA.