Open agitator opened 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
+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
Products/CMFCore/DynamicType.py seems to return the icon_expr
value
(Pdb++) self.context.getIconURL()
'contenttype/document'
Is that enough?
yes, that's what the @@iconresolver
expects
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?
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.
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?
As long as the vocabulary is not defined in plone.app.vocabularies (otherwise dependency indirection), but in CMFPlone I am fine if it helps.
How it is expected to work:
/
support fallback to a more generic icon, for examplecontenttype/foo
will return the defaultcontenttype
icon_expr
property within thefti
oractions
should be used for the context specific lookup of an iconOpen Issues for icon resolver: