I am trying to set an icon for the controlpanel items of XML Director using CSS in Plone 5
However this does not seem to have any effect...is there a canonical way to associate icons in Plone 5 with controlpanel items?
Andreas
I am trying to set an icon for the controlpanel items of XML Director using CSS in Plone 5
However this does not seem to have any effect...is there a canonical way to associate icons in Plone 5 with controlpanel items?
Andreas
what about
<configlet
icon_expr="string:$portal_url/my_icon.png"
for reference see also https://github.com/plone/Products.CMFPlone/blob/master/Products/CMFPlone/profiles/default/controlpanel.xml
The "icon_expr" attribute seems to be used for Plone 4 only. They are irrelevant in Plone 5 I guess since the icons seem to come from some icon font "fontello".
-aj
The icons for the default controlpanel items are coming from the custom-fontello webfont.
There was an unfinished discussion at the sprint about this icons for other addons...
I think it would be good to allow an override via icon_expr to use svgs as icons instead (icons should be scalable for the new controlpanel), so not every addon has to come up with it's own webfont. @sneridagh @vangheem what do you think?
For now I would add a style to the addon specific stylesheet, add a character for the generated controlpanel class and set a webfont that contains the icon
.icon-controlpanel-plone_app_caching:before {
content: '\e82e';
}
It would be nice to be able to support icon_expr in some way. Otherwise, we need to give deprecation warnings some how.
it worked on my Plone 5 site
( I installed https://pypi.python.org/pypi/medialog.controlpanel and the icon show up in my Plone 5 site)
Latest b3 has a different control panel.
could it be an idea to set a default icon, maybe add a class to set the icon on, or
change:
.icon-controlpanel-PloneReconfig::before
to
[class^="icon-controlpanel"]::before,
.icon-controlpanel-PloneReconfig::before
(might have to move that line first or last)
(giving all unset control panels the plone logo icon)
PS: content (in CSS) can never be an image, just text
Just an FYI, despite not doing anything anymore with the current Plone 5.0 build the icon_expr can still be seen/modified inside the ZMI whilst serving no purpose.
I found a way to use an svg as an icon. For the default icons its fine to use a webfont, for custom addons this does not make much sense. Its really to much work for just an silly icon in a control-panel. I'd prefer to get back the icon_expr
.
So here is what I did further reading Strategies for LESS/CSS in addons?):
grunt
is available in your PATH./bin/instance start
, go to browser, create a Plone site named Plone
with your addon installed./bin/plone-compile-resources --site-id=Plone --compile-dir=./src/pas/plugins/authomatic/browser/resources/ --bundle=authomatic-addon
(which fails today, but worked fine ~2weeks ago ..., need to investigate here)Lots of work for just an icon, I'd really like to reenable the icon_expr for simple addons.
After this write up and realizing how much work and how crazy this way of adding just an icon is I'am sure not supporting icon_expr
was for sure an accident. I filed a regression issue here https://github.com/plone/Products.CMFPlone/issues/1236
https://www.youtube.com/watch?v=pbTNZN6m0HM ... bring it back to me!
Just felt the pain of trying to put an icon on an add-on for Plone 5.
I'll invest a bit more time to see if there's an elegant approach, but it's feeling like icon_expr would be a good thing.
Could it be possible to set an 'iconclass', and then add this class to the 'icon-controlpanel-nameofaddon" ?
so: iconclass = 'icon-edit'
would give html: span class="icon-edit icon-controlpanel-some_product"
and a pencil as icon
we already have
<span class="icon-controlpanel-mosaic-layout-editor"></span>
@espenmn we already have classes, but registering an icon-font or svg plus css just for an custom icon in controalpanel is just to much overhead as mentioned above.
if it was possible to add classes, the css is probably already there to show the icon (?) I used firebug to change span="icon-bla-bl-bla
to:
span class="icon-bla-bla-bla icon-edit
and the pencil icon shows up withouth further chages as it is already included in 'icons.less'