Where to configure an icon for a dexterity type in Plone 5.2.6?

Our customer wants different icons for our dexterity types.

None of the following seems to work:

  • neither setting the property icon_expr in the file profiles/default/types/mytype.xml
  • nor setting Icon (Expression) under portal_types/mytype/manage_propertiesForm

How can we configure it?

Icons in 5.x are done with web fonts, you'll have to override the class in your styles/theme https://github.com/plone/plonetheme.barceloneta/blob/2.x/plonetheme/barceloneta/theme/less/contents.plone.less#L27

Plone 6 will make use of icon_expr again with svgs.

But also without theme. It seems that there is no information about icons in the unstyled code.

Does this mean that addon-developers must also deliver a theme?

Looking at collective.easyform you can define some CSS in your addon to place the desired icon for your contenttype:

Glyphicons are included per default, but if you want other Icons you have to ship your icon font. But speaking in CSS you could even place your SVG image as content type icon ...

1 Like

It's been a while and we are now on Plone 6.

In Plone 6 icons for content types can be defined with a registry record.

E.g. in your addon in profiles/default/registry/main.xml

<record name="plone.icon.contenttype/my_content_type">
  <field type="plone.registry.field.TextLine">
    <title>My Content Type</title>
  </field>
  <value key="resource">++plone++bootstrap-icons/people-fill.svg</value>
</record>

I think this is the setting for 'folder_contents' etc.

For 'add menu', it can probably be set with:

   <record name="plone.icon.action_items">
       <field type="plone.registry.field.TextLine">
       </field>
        <value>++plone++my.addon/icons/action_icon.svg</value>
  </record>

And then in the type (xml)

 <property name="icon_expr">string:action_items</property>

It might be best to use two different, to get the size and color right (?)