plone / Products.CMFPlone

The core of the Plone content management system
https://plone.org
GNU General Public License v2.0
249 stars 188 forks source link

icon resolver summarized issues #3500

Open agitator opened 2 years ago

agitator commented 2 years ago

How it is expected to work:

Open Issues for icon resolver:

agitator commented 2 years ago

Regarding https://github.com/plone/mockup/issues/1159#issuecomment-1111896146 and reading https://docs.plone.org/develop/plone/searching_and_indexing/indexing.html#default-plone-indexes-and-metadata-columns ... should we rethink what we do with getIcon? @mauritsvanrees @jensens @ale-rt @petschki @MrTango

petschki commented 2 years ago

+1000

what about a catalog metadata content_icon or type_icon which contains the registry key for the icon. this would make it easy for the folder_contents to get the correct icons

agitator commented 2 years ago

Products/CMFCore/DynamicType.py seems to return the icon_exprvalue

(Pdb++) self.context.getIconURL()
'contenttype/document'

Is that enough?

petschki commented 2 years ago

yes, that's what the @@iconresolver expects

yurj commented 2 years ago

Something in the metadata but not in the index... Anyway I would not change it because it can be used. What is the purpose of using the catalog? We just need a map from the content type to the icon string (as above), something like:

{'Document': 'contenttype/document',
 'Image': 'contenttype/image',
...
}

This can be built on startup querying the registry and cached?

petschki commented 2 years ago

for example pat-structure gets the item info via plone.app.vocabularies.Catalog ... if you make a mapping, you have to read the map in mockup and use it with a utility etc... catalog metadata would be much simpler as the data is simply there, where you need it.

yurj commented 2 years ago

What about then to add the content type icons on a vocabulary typeIcons and get them with '/@@getVocabulary?name=plone.app.vocabularies.typeIcons'? This can be also cached in the browser and reused by Volto. For example, how Volto get the icon in folder contents?

jensens commented 2 years ago

As long as the vocabulary is not defined in plone.app.vocabularies (otherwise dependency indirection), but in CMFPlone I am fine if it helps.