[TYPO3-english] addTcaTypeIcon

Jigal van Hemert jigal.van.hemert at typo3.org
Sat Jul 23 11:27:39 CEST 2016


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/

-- 
Jigal van Hemert
TYPO3 CMS Active Contributor

TYPO3 .... inspiring people to share!
Get involved: typo3.org


More information about the TYPO3-english mailing list