php - How to customise the icon of an areablock in Pimcore
The company I work for uses Pimcore 6 to make websites.
In the adminpanel while editing a page you can addareablocks
to your content.
When you click on the plus sign, you can add a newareablock
, I have noticed that theareablocks
have a random icon next to their name.
I thought that this was because the person who created them was too lazy to create or add the right ones.
After looking at the official DEMO on the Pimcore website. I noticed that theirareablocks
also have random icons.
I was wondering if it is possible to customise these?
After doing some research it seems that this is possible by adding aicon.png
into your areablock's folder.
That's what I have tried. But the random icon is still displaying. My custom icon is getting ignored. Anyone any idea what I'm doing wrong?
Answer
Solution:
Pasting the icon into the view is not helpful (or was some wrong information). When you are registering a brick and check the methods of
AbstractTemplateAreabrick
you will notice that it has some classgetIcon()
. And this is the method you have to override in case you want to set custom icons.The
AreabrickInterface
defines the method like this:An absolute image URL is needed. In my case I just do it with base64 .svgs - here is a working example: