[TYPO3-english] addTcaTypeIcon

Jacco van der Post jacco at id-internetservices.com
Sat Jul 23 12:36:01 CEST 2016


Op 23-7-2016 om 11:27 schreef Jigal van Hemert:
> Hi,
>
> On 23/07/2016 10:08, Philipp Gampe wrote:
>> Jacco van der Post wrote:
>>
>>> To get an icon in the tree it used to be
>>>
>>> \TYPO3\CMS\Backend\Sprite\SpriteManager::addTcaTypeIcon('pages',
>>> 'contains-myext', '../typo3conf/ext/my_ext/ext_icon.gif');
>>>
>>> addTcaTypeIcon is deprecated and doesnt work anymore in 7.6, any hint
>>> how to do it now?
>>
>> Took me some searching too, here is the corresponding change
>> documentation.
>>
>> https://docs.typo3.org/typo3cms/extensions/core/7.6/Changelog/7.5/Feature-68741-IntroduceNewIconFactoryAsBaseForReplaceTheIconSkinningAPI.html
>>
>
> And for a code example:
>
> $iconRegistry =
> \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class);
>
> $iconRegistry->registerIcon(
>   'tcarecords-pages-contains-myext',
>   \TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider::class,
>   ['source' => 'EXT:my_ext/ext_icon.gif']
> );
>
> $GLOBALS['TCA']['pages]['ctrl']['typeicon_classes']['contains-myext'] =
> 'tcarecords-pages-contains-myext';
>
> Once you've registered an icon under a certain ID you can use it in a
> lot of places by just referring to that name.
>
> Further info:
> https://usetypo3.com/icon-api.html
> https://www.web-dev-net.de/icon-api-in-typo3-ab-version-7-5/
>

Thanks! This I was looking for (ext_tables.php):

$TCA['pages']['ctrl']['typeicon_classes']['contains-myext'] = 
'tcarecords-pages-contains-myext';

Now I have my own cool pagetree icon :D

-- 
Kind Regards

Jacco van der Post


More information about the TYPO3-english mailing list